\ãëàâíàÿ\ð.ë. êîíñòðóêöèè\ðàçíîå\...

«Ëèñà» íà ATtiny2313

Ñõåìà ïðîñòåéøåé «ëèñû» íà ÷àñòîòó 3,580 ÌÃö ðîäèëàñü âî âðåìÿ ýêñïåðèìåíòîâ ñ ìèêðîêîíòðîëëåðàìè. Ïðèíöèï åå äåéñòâèÿ ïðîñò: òàêòîâàÿ ÷àñòîòà ïðîãðàììíî äåëèòñÿ è ïðîãðàììíî æå âûäàåòñÿ íà âûõîä, íàãðóæåííûé íà ðåçîíàíñíûé êîíòóð, ê êîòîðîìó ïîäêëþ÷åíà àíòåííà.

Êâàðöåâûé ðåçîíàòîð - íà 14,318 ÌÃö (ñòîÿò íà êîìïüþòåðíûõ ìàòåðèíñêèõ ïëàòàõ), ìèêðîñõåìà, ñîîòâåòñòâåííî, äîëæíà áûòüATtiny2313-20 (20 ÌÃö).

Êàòóøêà âûõîäíîãî êîíòóðà ìîæåò áûòü ëþáîé – ìû ïîñòàâèëè äðîññåëü ÄÌ è ïîäîáðàííûé äî ïîÿâëåíèÿ ðåçîíàíñà äèñêîâûé êîíäåíñàòîð. Ìîæíî îáîéòèñü è áåç íèõ - èñêëþ÷èòü C7, L1 è R2, òîãäà àíòåííà ÷åðåç Ñ6 ïîäêëþ÷àåòñÿ ê 14 íîæêå ìèêðîñõåìû.

Àêêóìóëÿòîð èñïîëüçîâàëè îò ñîòîâîãî òåëåôîíà (ó íàñ íèêåëü-ìàðãàíöåâûé 650 mAh îò ñòàðîãî Siemens-à, õâàòàåò íàäîëãî – çà ãîä îòðàáîòàë 30-50 ÷àñîâ, è ïîêà åù¸ íå ïîäçàðÿæàëè). Ïðîâîäà ïèòàíèÿ àêêóðàòíî ïîäïàÿíû íàïðÿìóþ ê êîíòàêòàì àêêóìóëÿòîðà.

Âñÿ êîíñòðóêöèÿ ñîáðàíà íàâåñíûì ìîíòàæîì íà ìàêåòíîé ïëàòå è ïîìåùåíà â êîðïóñ îò ñòàðîé êîìïüþòåðíîé «ìûøè», ÷òî âûçûâàåò ó äåòåé íåêîòîðîå íåïîíèìàíèå äåéñòâèòåëüíîñòè.  Õâîñòèê «ìûøè» – ýòî àíòåííà «ëèñû» (ó íàñ äëèííîé ÷óòü áîëåå ìåòðà) - ìíîãîæèëüíûé ãèáêèé ïðîâîä â èçîëÿöèè.

«Ëèñà» ñî ñâåðíóòîé â êîìîê àíòåííîé è ñïðÿòàííàÿ â ïîðòôåëü óñòîé÷èâî îïðåäåëÿåòñÿ ïåëåíãàòîðîì ñ ðàññòîÿíèÿ 5 -10 ìåòðîâ – ýòî òàêàÿ èãðà äëÿ ñàìûõ ìàëåíüêèõ – «Íàéäè, â ÷ü¸ì ïîðòôåëå ïåðåäàò÷èê». Íà ôîòî: íàéäåíà «ëèñà» ñïðÿòàííàÿ â êàðìàíå.

 

 

 Ñ ðàçâåðíóòîé àíòåííîé è íàõîäÿñü íà âåòêå äåðåâà (âûñîòà 1-2 ìåòðà íàä çåìëåé) ñëûøíà ñ 20-30 ìåòðîâ.

Óâåëè÷åíèåì äàëüíîñòè è ìîùíîñòè èçëó÷åíèÿ íå çàíèìàëèñü – õîòÿ, âîçìîæíî, ñàìûé ïðîñòîé ñïîñîá óâåëè÷èòü ìîùíîñòü, ýòî âìåñòî R2 ïîñòàâèòü ýìèòòåðíûé ïîâòîðèòåëü è ïîäîáðàòü îòâîäû ó êîíòóðà.

            Êíîïêó «Reset» ïîñòàâèëè óæå â ðàáî÷óþ êîíñòðóêöèþ äëÿ óäîáñòâà.

            Ïðè ïðîãðàììèðîâàíèè ìèêðîñõåìû èñïîëüçîâàëè ïðîãðàììó PonyProg, ñîñòîÿíèå fuse bits äëÿ ATtiny2313 ïðè èñïîëüçîâàíèè êâàðöåâîãî ðåçîíàòîðà íà ÷àñòîòó áîëåå 8 ÌÃö - ãàëî÷åê íåò, ò.å. óñòàíîâëåíû åäèíè÷êè:

 

            Ñàìà ïðîãðàììà ïèñàëàñü â AVR Studio, íèæå ïðèâåäåí ëèñòèíã äëÿ òåõ, êòî ïîæåëàåò ïîìåíÿòü èìÿ «ëèñû», âûäàâàåìîå â ýôèð, à òàê æå àëãîðèòì ðàáîòû (ïàóçû, äëèòåëüíîñòè). Íàøà æå èçëó÷àåò ñëîâî èç áóêâ «Ì», «Î», «Å» ÷åòûðå ðàçà, çàòåì èäåò äëèííàÿ ïàóçà îêîëî ïîëóìèíóòû, îïÿòü ñëîâî ÌÎÅ ÷åòûðå ðàçà, îïÿòü äëèííàÿ ïàóçà è òàê äàëåå ïî êðóãó.

Âûõîäíàÿ ÷àñòîòà ïåðåäàò÷èêà îïðåäåëÿåòñÿ ïî ôîðìóëå Fâûõ=Fêâ/2*(n+1), ãäå n= êîýôôèöèåíò äåëåíèÿ òàéìåðà OCR0A. Ó íàñ ñòîèò n=1 è äåëèò íà 4, à ïðè n=3 Fêâ ïîäåëèòñÿ â âîñåìü ðàç.

Âðîäå áû âñ¸ ïðîñòî.

À äëÿ òîãî, ÷òîáû ïîìåíÿòü áóêâó «Å» íà áóêâó «À», íàäî çàìåíèòü òî÷êó êîäà Ìîðçå íà òî÷êó è òèðå, à òàêæå ïîñòàâèòü êîðîòêóþ ïàóçó ìåæäó íèìè, ò.å. äîáàâèòü äâà ñèìâîëà.  íà÷àëå ïðîãðàììå â ñòðîêå «.equ ch =12  ;Êîë-âî ñèìâîëîâ â èìåíè ëèñû» ìåíÿåì ÷èñëî 12 íà 14, çàòåì â òàáëèöå â ñàìîì íèçó ïðîãðàììû ñòðîêó «.db 0x01 ; Áóêâà Å» ìåíÿåì íà «.db 0x01, 0x81, 0x03 ;Áóêâà À» (÷òî òàêîå 0x01, 0x81, 0x03 ñì. òàáëèöó ñèìâîëîâ âíèçó ïðîãðàììû). Êîíå÷íî, ýòà ïðîñòîòà íå îòìåíÿåò çíàíèå àññåìáëåðà è óìåíèÿ ïîëüçîâàòüñÿ AVR Studio.

 

;********************************

; Ëèñà íà 3.5 ÌÃö íà ATtiny 2313

;********************************

 

.include "tn2313def.inc"

 

.equ        freq        =14318200                          ;×àñòîòà êâàðöà

.equ        period    =125                                      ;Äëèòåëüíîñòü ÒÎ×ÊÈ è êîðîòêîé ïàóçû 125 ìñåê

.equ        ch                           =12                        ;Êîë-âî ñèìâîëîâ â èìåíè ëèñû

.equ        kol                          =4                           ;Êîë-âî ïîâòîðîâ èìåíè â îäíîé ïîñûëêå

 

.def         tmp                        =r16

.def         count1   =r17

.def         count2   =r18

.equ        speed     =period*freq/64000

 

.CSEG

.org         0

                rjmp       RESET

                nop                        ;rjmp      EXT_INT0           ;Âíåøíèå ïðåðûâàíèå ïî IRQ0

                nop                        ;rjmp      EXT_INT1           ;Âíåøíèå ïðåðûâàíèå ïî IRQ1

                nop                        ;rjmp      TIM1_CAPT       ;Ïðåðûâàíèå ïî òàéìåðó 1

                rjmp       TIM1_COMPA                                  ;Ïðåðûâàíèå ïî ñðàâíåíèþ òàéìåð 1

                nop                        ;rjmp      TIM1_OVF          ;Ïðåðûâàíèå ïî ïåðåïîëíåíèþ òàéìåð 1

                nop                        ;rjmp      TIM0_OVF          ;Ïðåðûâàíèå ïî ïåðåïîëíåíèþ òàéìåð 0

                nop                        ;rjmp      USART0_RXC    ;

                nop                        ;rjmp      USART0_DRE    ;

                nop                        ;rjmp      USART0_TXC    ;

                nop                        ;rjmp      ANA_COMP        ;Ïðåðûâàíèå àíàëîãîâîãî êîìïàðàòîðà

                nop                        ;rjmp      PCINT

                nop                        ;rjmp      TIMER1_COMPB

                nop                        ;rjmp      TIMER0_COMPA

                nop                        ;rjmp      TIMER0_COMPB

                nop                        ;rjmp      USI_START

                nop                        ;rjmp      USI_OVERFLOW

                nop                        ;rjmp      EE_READY

                nop                        ;rjmp      WDT_OVERFLOW

               

.org         0x0013

TIM1_COMPA:

                reti

RESET:

                ldi                           tmp,       RAMEND             ; Íàñòðàèâàåì

                out                         SPL,       tmp                        ; ñòåê.

                ldi                           tmp,       1<<SE

                out                         MCUCR,              tmp

                ldi                           tmp,       high(speed)

                out                         OCR1AH,             tmp

                ldi                           tmp,       low(speed)

                out                         OCR1AL,             tmp

                ldi                           tmp,       1<<OCIE1A

                out                         TIMSK, tmp

                ldi                           tmp,       (1<<CS10)|(1<<WGM12)|(1<<CS11)

                out                         TCCR1B,             tmp

                ldi                           tmp,       1                             ;êîýôôèöèåíò äåëåíèÿ

                out                         OCR0A,                tmp                        ;äëÿ òàéìåðà

                ldi                           tmp,       (1<<COM0A0)|(1<<WGM01)

                out                         TCCR0A,             tmp

                ldi                           tmp,       1

                out                          TCCR0B,             tmp

                sei

                ldi                           count2,  kol

l3:

                ldi                           count1,  ch

                ldi                           zh,                          high(2*Tabl)

                ldi                           zl,                           low(2*Tabl)

l2:

                lpm                        tmp,       z+

                cpi                          tmp,       0

                breq        l2

                bst                          tmp,       7

                brts         pause

                sbi                          DdrB,     2

l1:

                sleep

                dec                         tmp

                brne        l1

l4:

                dec                         count1

                brne        l2

                dec                         count2

                brne        l3

                ldi                           count2,  kol+1

                ldi                           count1,  1

                cbi                          DdrB,     2

                ldi                           tmp,       0xFF

                rjmp       p1

pause:

                cbr                          tmp,       1<<7

                cbi                          DdrB,     2

p1:                                                                        ;äëèííàÿ ïàóçà ïîñëå ïåðåäà÷è èìåíè ëèñû

                sleep

                dec                         tmp

                brne        p1

                rjmp       l4

 

; Òàáëèöà ñèìâîëîâ:

; 0x03 - ýòî ÒÈÐÅ â êîäå

; 0õ01 - ýòî ÒÎ×ÊÀ â êîäå

; 0õ81 - ýòî êîðîòêàÿ ïàóçà ìåæäó çíàêàìè

; 0õ83 - ýòî ïàóçà ìåæäó áóêâàìè

; 0õ86 - ýòî ïàóçà ìåæäó ñëîâàìè

Tabl:

.db 0x03, 0x81, 0x03                                        ; Áóêâà Ì "òèðå" "êîðîòêàÿ ïàóçà" "òèðå"

.db 0x83                                                                              ; Äëèííàÿ ïàóçà

.db 0x03, 0x81, 0x03, 0x81, 0x03                 ; Áóêâà Î

.db 0x83                                                                              ; Äëèííàÿ ïàóçà

.db 0x01                                                                              ; Áóêâà Å

.db 0x86                                                                              ; Ïàóçà ìåæäó ñëîâàìè

 

.exit

 

            Àëãîðèòì ðàáîòû ïåðåäàò÷èêà è åãî ìîùíîñòü, ñêîðåå âñåãî íå ñîîòâåòñòâóþò ïðèíÿòûì ñòàíäàðòàì ïî «ëèñîëîâñòâó», íî ïðè æåëàíèè ìîæíî ïîäîãíàòü ïðîãðàììó è ñõåìîòåõíèêó äëÿ ïîëíîöåííîé ðàáîòû.

Çàïèñàâ â ïðîãðàììó ïîçûâíîé, ìîæíî ïðèìåíèòü «ëèñó» è êàê ðàäèîìàÿê, à ñìåøàâ ñ äðóãèìè ÷àñòîòàìè ìîæíî èñïîëüçîâàòü è íà áîëåå âûñîêèõ ÷àñòîòàõ.

Òàêæå ïðîâåðèëè ðàáîòîñïîñîáíîñòü ñõåìû â çâóêîâîì äèàïàçîíå, çàìåíèâ êâàðö íà 4 ÌÃö, ïîìåíÿâ â ïðîãðàììå ñòðîêè:   .equ     freq    =500000    ;×àñòîòà êâàðöà (íà ñàìîì äåëå êâàðö 4 ÌÃö, íî âêëþ÷èâ âíóòðåííèé äåëèòåëü íà 8, ïîñòàâèâ ãàëî÷êó â îêíå CKDIV8 ïðè ïðîãðàìèðîâàíèè â PonyProg, ïîëó÷àåì 0,5 ÌÃö) è óâåëè÷èâ êîýôôèöèåíò äåëåíèÿ â ñòðîêå   ldi          tmp,   249   ;êîýôôèöèåíò äåëåíèÿ

                 îut   OCR0Atmp   ;äëÿ òàéìåðà.

             èòîãå ïîëó÷èëè 1 êÃö (ïî ïðàâäå ãîâîðÿ, ïîëó÷èëè 1024 Ãö, ïîòîìó ÷òî êâàðö ïîïàëñÿ íà 4,096 ÌÃö).

            Fuse äëÿ çâóêîâîãî âûäà:   

 

 

            Ôàéë ñ èñõîäíèêîì è ïðîøèâêîé «ëèñû» íà 3,5 ÌÃö, à òàê æå àóäèîçàïèñü ñ ýôèðà ïðèëàãàåòñÿ.

Ïî âñåì âîïðîñàì îáðàùàéòåñü sibmon@yandex.ru, íî îïåðàòèâíîñòè îòâåòîâ íå ãàðàíòèðóåì.

 

Àâòîðû:  Áàëèìîâ Ýäóàðä,  Ãîëüöîâ Àíäðåé.

Âîçâðàò

Ïîìîãóò òóò ïîäîáðàòü îáîðóäîâàíèå äëÿ ñèñòåìû àâòîìàòèçàöèè Siemens! Íåîáõîäèìà ìîùíàÿ êàòóøêà äëÿ ñïèííèíãà äëÿ ëîâëè êðóïíîé ðûáû è ñëîæíûõ óñëîâèé.