![]() |
|
Модераторы: PILOT, ManiaK, Mazzi |
![]()
|
|
| Artik666 |
|
|||
|
Новичок Профиль Группа: Участник Сообщений: 1 Регистрация: 19.12.2014 Репутация: нет Всего: нет |
Доброе время суток. Имеется программный код на асме для Lan тестера. Проект взят с данного ресурса: http://eldigi.ru/articles/tester_dlya_lan_kabelya. Кто нибудь может мне пояснить программный код и его принцип работы. По возможности детским языком. Уровень знаний очень мал в этой области( А еще за одно может мне кто нибудь подскажет для чего нужны 3 светодиода подключенных к 2,3,6 ноге? Надеюсь на вашу помощь.
; Test rj45 cable, by Stergiopoulos B. For any AVR. Here is for ATtiny2313 ; ajust internal clock to 8MHz or change accordingly Td value below. ; ***************************************************************************** ; The mpu produces successive outputs at portD, where the LAN-cable is connected. ; So we can tell if all wires of cable are connected and in which order. ; Just watch the glow order of the LEDs. If a straight cable is connected between ; connectors A and B, then the LEDs will glow in successive order. ; If a cross cable is connected, then the glow order will be as noted on the board, ; i.e. 1,2,7,4,5,8,3,6. If any other glow order occurs, it means that the cable ; is not wired correctly. If one ore more LEDs don't glow, then we have corresponding ; lack of contact. ; An extra remote unit with only B connector (B2) can be used, in case that both ; ends of the cable cannot be brought close enough to be connected on the same board. ; See diagram. .NOLIST .INCLUDE "tn2313def.inc" .LIST ; Code starts here .CSEG .ORG $0000 .def temp1 = r16 .def T1 = r17 .def T2 = r18 .def T3 = r19 .def cnt = r29 ; binary counter 0-7 .def indexL = r30 ; these registers are for lpm instruction .def indexH = r31 .equ Td = 3 ; delay time rjmp RESET ; Reset Handler ; ****************** routines ***************************************** delay: ser T1 ; long delay ser T2 ldi T3,Td sdel1: dec T1 brne sdel1 ser T1 dec T2 brne sdel1 ser T2 dec T3 brne sdel1 ret ; ******************** Main program ******************************** RESET: ldi r16,LOW(RAMEND) ;Initiate Stackpointer. out SPL,r16 ser temp1 out ddrA,temp1 out ddrB,temp1 out ddrD,temp1 out portB,temp1 clr temp1 out portA,temp1 out portD,temp1 rcall delay ; test LEDs start: ldi indexH,HIGH(2*leds) ldi indexL,LOW(2*leds) clr cnt st1: lpm temp1,z+ out portB,temp1 out portD,cnt inc cnt cpi cnt,8 brne st2 clr cnt st2: rcall delay cpi temp1,128 ; end of row? breq start rjmp st1 ; take next data leds: .db 1, 2, 4, 8, 16, 32, 64, 128 Это сообщение отредактировал(а) Artik666 - 19.12.2014, 23:44 |
|||
|
||||
| Romikgy |
|
|||
![]() Любитель-программер ![]() ![]() ![]() ![]() Профиль Группа: Участник Клуба Сообщений: 7326 Регистрация: 11.5.2005 Где: Porto Franco Odes sa Репутация: 3 Всего: 146 |
отображает какой провод подключен (счетчик проводов) PS имхо вашу тему надо в "центр помощи" -------------------- Владение русской орфографией это как владение кунг-фу — истинные мастера не применяют его без надобности. |
|||
|
||||
![]()
|
| Правила форума "Микроконтроллеры (MCU) и микропроцессоры (MPU)" | |
|
|
На данный раздел помимо Правил форума распространяются текже следующие правила:
Если Вам понравилась атмосфера форума, заходите к нам чаще! С уважением, PILOT, ManiaK, UniBomb, Mazzi. |
| 0 Пользователей читают эту тему (0 Гостей и 0 Скрытых Пользователей) | |
| 0 Пользователей: | |
| « Предыдущая тема | Микроконтроллеры (MCU) и микропроцессоры (MPU) | Следующая тема » |
|
|
По вопросам размещения рекламы пишите на vladimir(sobaka)vingrad.ru
Отказ от ответственности Powered by Invision Power Board(R) 1.3 © 2003 IPS, Inc. |