LIST P=PIC16F84 ;********************************************************************* ; FM Transceiver 144MHz (2m) ; Date: 22.07.1999. V.1.4 ; YT2FSG - Stankovic Goran dipl.ing.el. E-mail: goranstak@gmail.com ;******************************************************************* ; LCD Control Lines ; RA1 = R_W ; RA0 = RS ; RA2 = E ; LCD Data Lines ; RB<7:4> #include P16F84.INC __FUSES (_CP_ON & _WDT_ON & _XT_OSC & _PWRTE_ON ) TEMP equ 20h ;Temporary storage location CHAR EQU 21h ;Character storage location TEMP1 equ 22h ;Temporary storage location COUNT EQU 23h ; Brojac za taster T_COUNT EQU 24h TEMP2 EQU 26h digit1 EQU 27h digit2 EQU 28h digit3 EQU 29h digit4 EQU 2Ah BR_BIT EQU 2Bh FREQ1 EQU 2Ch FREQ2 EQU 2Dh temp EQU 2Eh count EQU 2Fh MODE_B EQU 30h FUNC_B EQU 31h C_Ch EQU 32h C_VFO EQU 33h C_Rx EQU 34h C_Tx EQU 35h FLEG1 EQU 36h FLEG2 EQU 37h FUNC_B1 EQU 38h R0 equ 40h ; RAM Assignments R1 equ 41h R2 equ 42h R3 equ 43h ; temp memory ARG0 equ 44h ARG1 equ 45h TEMPB0 equ 46h TEMPB1 equ 47h DAT EQU PORTB CNTRL EQU PORTA RS EQU 0 RW EQU 1 E EQU 2 ; Bits za I2C-BUS SDA equ 0 SCL equ 1 EN2 equ 3 EN3 equ 4 #define CHAN MODE_B,0 #define VFO MODE_B,1 #define FULL_Rx MODE_B,2 #define FULL_Tx MODE_B,3 #define S_D FUNC_B,0 #define M600 FUNC_B,1 #define P600 FUNC_B,2 #define S12_25 FLEG1,0 #define RxTx FLEG1,1 #define PTT_F FLEG2,0 #define BUSY_F FLEG2,1 #define _C STATUS,0 #define _Z STATUS,2 #define TASTER1 PORTB,4 #define TASTER2 PORTB,5 #define TASTER3 PORTB,6 #define TASTER4 PORTB,7 ;--------------------------------------------------------------------- org 00 ;RESET vektor clrf STATUS clrf INTCON ; goto Start ;--------------------------------------------------------------------- ; Inicijilizacija programa ;--------------------------------------------------------------------- Start bsf STATUS, RP0 ; Bank 1 movlw B'00001111' ;WDT=2,3sec movwf OPTION_REG clrf TRISA ; RA5-0 outputs movlw B'11111111' movwf TRISB ; RB7-0 inputs bcf STATUS, RP0 ; Bank 0 clrf PORTA ;clear port_a call Ini_Rx nop call Ini_Tx nop call Read_EEPROM clrf FLEG2 ; clrf FLEG1 call LCDInit call Print_SetUp movf FUNC_B,W movwf FUNC_B1 call Prikazi ;--------------------------------------------------------- ; TASTATURA ;--------------------------------------------------------- MAIN Taster clrwdt bcf CNTRL,E bcf CNTRL,RS movlw 0x80 movwf T_COUNT Taster_loop_11 btfsc TASTER1 goto Taster2 decfsz T_COUNT,F goto Taster_loop_11 goto Ispitaj_Taster1 Taster2 Taster_loop_12 btfsc TASTER2 goto Taster3 decfsz T_COUNT,F goto Taster_loop_12 goto Ispitaj_Taster2 Taster3 Taster_loop_13 btfsc TASTER3 goto Taster4 decfsz T_COUNT,F goto Taster_loop_13 goto Ispitaj_Taster3 Taster4 Taster_loop_14 btfsc TASTER4 goto Taster_s decfsz T_COUNT,F goto Taster_loop_14 goto Ispitaj_Taster4 Taster_s bcf CNTRL,E bsf CNTRL,RS btfsc TASTER1 ;PTT goto Taster_s_11 btfsc PTT_F goto Taster_s_12 btfsc MODE_B,2 ;PTT je pritisnut goto Taster_s_12 bsf PTT_F call Prikazi goto Taster_s_12 Taster_s_11 btfss PTT_F goto Taster_s_12 btfsc MODE_B,2 ;PTT je pusten goto Taster_s_12 bcf PTT_F call Prikazi goto Taster_s_12 Taster_s_12 bcf CNTRL,E bsf CNTRL,RS btfsc TASTER4 ;Busy goto Taster_s_21 btfsc BUSY_F goto Taster_s_22 btfsc MODE_B,2 ;Busy je prisutan goto Taster_s_22 bsf BUSY_F call Busy goto Taster_s_22 Taster_s_21 btfss BUSY_F goto Taster_s_22 btfsc MODE_B,2 ;Busy nije prisutan goto Taster_s_22 bcf BUSY_F call Pozivni_znak goto Taster_s_22 Taster_s_22 goto Taster_exit Taster_pusten clrwdt bcf CNTRL,E bcf CNTRL,RS Taster_pusten_p movlw 0x80 movwf T_COUNT Taster_loop_2 btfss TASTER1 goto Taster_pusten btfss TASTER2 goto Taster_pusten btfss TASTER3 goto Taster_pusten btfss TASTER4 goto Taster_pusten decfsz T_COUNT,F goto Taster_loop_2 Taster_exit goto MAIN ;- - - - - - - - - - - - - - - - - - - - - - Ispitaj_Taster1 ;IncCount btfsc MODE_B,0 goto IncCout_1 btfsc MODE_B,1 goto IncCout_2 btfsc MODE_B,2 goto IncCout_3 goto Taster_pusten IncCout_1 incf C_Ch,F movlw .24 subwf C_Ch,W btfss _C goto Taster_IncCout_11 clrf C_Ch Taster_IncCout_11 call Prikazi call EE_upis_Ch goto Taster_pusten IncCout_2 incf C_VFO,F movlw .160 subwf C_VFO,W btfss _C goto Taster_IncCout_21 clrf C_VFO Taster_IncCout_21 call Prikazi call EE_upis_VFO goto Taster_pusten IncCout_3 btfsc RxTx goto IncCout_4 incf C_Rx,F movlw .160 subwf C_Rx,W btfss _C goto Taster_IncCout_31 clrf C_Rx Taster_IncCout_31 call Prikazi call EE_upis_Rx goto Taster_pusten IncCout_4 incf C_Tx,F movlw .160 subwf C_Tx,W btfss _C goto Taster_IncCout_41 clrf C_Tx Taster_IncCout_41 call Prikazi call EE_upis_Tx goto Taster_pusten ;- - - - - - - - - - - - - - - - - - - - - - Ispitaj_Taster4 ;DecCount btfsc MODE_B,0 goto DecCout_1 btfsc MODE_B,1 goto DecCout_2 btfsc MODE_B,2 goto DecCout_3 goto Taster_pusten DecCout_1 movf C_Ch,F btfsc _Z ;?=0 goto Taster_DecCout_11 decf C_Ch,F call Prikazi call EE_upis_Ch goto Taster_pusten Taster_DecCout_11 movlw .23 movwf C_Ch call Prikazi call EE_upis_Ch goto Taster_pusten DecCout_2 movf C_VFO,F btfsc _Z ;?=0 goto Taster_DecCout_21 decf C_VFO,F call Prikazi call EE_upis_VFO goto Taster_pusten Taster_DecCout_21 movlw .159 movwf C_VFO call Prikazi call EE_upis_VFO goto Taster_pusten DecCout_3 btfsc RxTx goto DecCout_4 movf C_Rx,F btfsc _Z ;?=0 goto Taster_DecCout_31 decf C_Rx,F call Prikazi call EE_upis_Rx goto Taster_pusten Taster_DecCout_31 movlw .159 movwf C_Rx call Prikazi call EE_upis_Rx goto Taster_pusten DecCout_4 movf C_Tx,F btfsc _Z ;?=0 goto Taster_DecCout_41 decf C_Tx,F call Prikazi call EE_upis_Tx goto Taster_pusten Taster_DecCout_41 movlw .159 movwf C_Tx call Prikazi call EE_upis_Tx goto Taster_pusten ;- - - - - - - - - - - - - - - - - - - - - - Ispitaj_Taster2 ;MODE bcf _C rlf MODE_B,F btfss MODE_B,3 goto Taster_Mode_1 clrf MODE_B bsf MODE_B,0 Taster_Mode_1 call Prikazi call EE_upis_MODE goto Taster_pusten ;- - - - - - - - - - - - - - - - - - - - - - Ispitaj_Taster3 ;FUNC btfsc MODE_B,0 goto FunCout_1 btfsc MODE_B,1 goto FunCout_2 btfsc MODE_B,2 goto FunCout_3 goto Taster_pusten FunCout_1 btfss S12_25 goto Taster_Func_11 bcf S12_25 call Prikazi call EE_upis_FUNC goto Taster_pusten Taster_Func_11 bsf S12_25 call Prikazi call EE_upis_FUNC goto Taster_pusten FunCout_2 bcf _C rlf FUNC_B,F btfss FUNC_B,3 goto Taster_Func_21 clrf FUNC_B bsf FUNC_B,0 Taster_Func_21 call Prikazi call EE_upis_FUNC goto Taster_pusten FunCout_3 btfss RxTx goto Taster_Func_31 bcf RxTx call Prikazi call EE_upis_FUNC goto Taster_pusten Taster_Func_31 bsf RxTx call Prikazi call EE_upis_FUNC goto Taster_pusten ;----------------------------------------------------------------- ; Duplex - Tx = FREQ + COUNT - 600 KHz ; Duplex + Tx = FREQ + COUNT + 600 KHz ; 600 KHz = 48 ; 10.7MHz = 856 (11520-856=10664) ; Tx: FREQH=45, FREQL=0 ; Tx-: FREQH=44, FREQL=208 ; Rx: FREQH=41, FREQL=168 ; FREQH=FREQ2, FREQL=FREQ1 Prikazi btfsc MODE_B,0 goto P_Chanal btfsc MODE_B,1 goto P_Vfo btfsc MODE_B,2 goto P_Full return P_Chanal movlw B'00001100' ;Display off, cursor off call SendCmd movlw B'11000000' call SendCmd movlw .10 subwf C_Ch,W btfss _C goto Skok_p1 movlw .1 movwf FUNC_B1 movlw 'S' goto Skok_p2 Skok_p1 movlw .2 movwf FUNC_B1 movlw 'R' Skok_p2 call SendChar movf C_Ch,W call BinBCD movf R0,W call SendChar1 movf R1,W call SendChar1 movlw ' ' btfsc S12_25 movlw 'x' call SendChar call Pozivni_znak call Sim_Dup movlw B'11000100' call SendCmd ; movf C_Ch,W bcf _C ; rlf C_Ch,W ;W=C_Ch*2 addlw .80 ;W=144+W btfsc PTT_F goto Skok_P_1 btfsc FUNC_B1,1 addlw .48 ;W=W+48 (-600KHz) Skok_P_1 btfsc S12_25 addlw .1 ;W=W+1 call P_P return P_Vfo movf FUNC_B,W movwf FUNC_B1 call Pozivni_znak call Sim_Dup movlw B'00001100' ;Display off, cursor off call SendCmd movlw B'11000000' call SendCmd movlw 'V' call SendChar movlw 'F' call SendChar movlw 'O' call SendChar movlw ' ' call SendChar movf C_VFO,W btfss PTT_F goto Skok_Ptt_1 btfss FUNC_B1,1 goto Skok_Ptt_2 movlw .48 subwf C_VFO,W ;W=C_VFO-48 (-600KHz) btfsc _C ;? W<0 goto Skok_Ptt_1 movlw .0 ;W=0 goto Skok_Ptt_1 Skok_Ptt_2 btfss FUNC_B1,2 goto Skok_Ptt_1 addlw .48 ;W=W+48 (+600KHz) Skok_Ptt_1 call P_P return P_Full movlw B'00000001' ;Display CLEAR call SendCmd movlw B'10000000' call SendCmd movlw 'R' call SendChar movlw 'x' call SendChar movlw '=' call SendChar movf C_Rx,W call P_P movlw B'11000000' call SendCmd movlw 'T' call SendChar movlw 'x' call SendChar movlw '=' call SendChar movf C_Tx,W call P_P movlw B'00001111' ;Display off, cursor on, BLINK call SendCmd movlw B'10001111' btfsc RxTx movlw B'11001111' call SendCmd return ;--------------------------------------------- P_P movwf ARG1 movwf ARG0 bcf _C rrf ARG1,F bcf _C rrf ARG1,F bcf _C rrf ARG1,F movf ARG1,W addlw .40 call BinBCD movlw ' ' call SendChar movlw '1' call SendChar movlw '4' call SendChar movf R0,W call SendChar1 movlw '.' call SendChar movf R1,W call SendChar1 btfsc ARG0,2 goto P_v_500 btfsc ARG0,1 goto P_v_250 btfsc ARG0,0 goto P_125 goto P_000 P_v_500 btfsc ARG0,1 goto P_v_750 btfsc ARG0,0 goto P_625 goto P_500 P_v_250 btfsc ARG0,0 goto P_375 goto P_250 P_v_750 btfsc ARG0,0 goto P_875 goto P_750 P_000 movlw '0' call SendChar movlw '0' call SendChar goto MHz__ P_125 movlw '1' call SendChar movlw '2' call SendChar goto MHz__ P_250 movlw '2' call SendChar movlw '5' call SendChar goto MHz__ P_375 movlw '3' call SendChar movlw '7' call SendChar goto MHz__ P_500 movlw '5' call SendChar movlw '0' call SendChar goto MHz__ P_625 movlw '6' call SendChar movlw '2' call SendChar goto MHz__ P_750 movlw '7' call SendChar movlw '5' call SendChar goto MHz__ P_875 movlw '8' call SendChar movlw '7' call SendChar MHz__ movlw .0 btfsc ARG0,0 movlw .1 call SendChar MHz movlw 'M' call SendChar movlw 'H' call SendChar movlw 'z' call SendChar return ;--------------------------------------------- Pozivni_znak movlw B'10000000' call SendCmd btfsc PTT_F goto On_air btfsc BUSY_F goto Busy movlw 'Y' call SendChar movlw 'T' call SendChar movlw '2' call SendChar movlw 'F' call SendChar movlw 'S' call SendChar movlw 'G' call SendChar movlw ' ' call SendChar movlw ' ' call SendChar return On_air movlw B'10000000' call SendCmd movlw 'O' call SendChar movlw 'N' call SendChar movlw ' ' call SendChar movlw 'A' call SendChar movlw 'I' call SendChar movlw 'R' call SendChar movlw ' ' call SendChar movlw ' ' call SendChar return Busy movlw B'10000000' call SendCmd movlw ' ' call SendChar movlw 'B' call SendChar movlw 'U' call SendChar movlw 'S' call SendChar movlw 'Y' call SendChar movlw ' ' call SendChar movlw ' ' call SendChar movlw ' ' call SendChar return Sim_Dup btfsc FUNC_B1,0 goto Simplex_ btfsc FUNC_B1,1 goto Duplex_M btfsc FUNC_B1,2 goto Duplex_P return return Simplex_ movlw B'10001000' call SendCmd movlw 'S' call SendChar movlw 'i' call SendChar movlw 'm' call SendChar movlw 'p' call SendChar movlw 'l' call SendChar movlw 'e' call SendChar movlw 'x' call SendChar return Duplex_M movlw B'10001000' call SendCmd movlw '-' goto P_600 Duplex_P movlw B'10001000' call SendCmd movlw '+' P_600 call SendChar movlw '6' call SendChar movlw '0' call SendChar movlw '0' call SendChar movlw 'K' call SendChar movlw 'H' call SendChar movlw 'z' call SendChar return ;-------------------------------------------------------------- ;Inicijalizacija 1.SAA 1057 Ini_Rx movlw 0xFD movwf FREQ2 movlw 0x04 movwf FREQ1 call I2C_OUT_Rx return ;Inicijalizacija 2.SAA 1057 Ini_Tx movlw 0xFD movwf FREQ2 movlw 0x04 movwf FREQ1 call I2C_OUT_Tx return ;-------------------------------------------------------------- I2C_OUT_Rx bcf PORTA,EN2 bcf PORTA,SDA bcf PORTA,SCL nop bsf PORTA,EN2 nop bsf PORTA,SCL bcf PORTA,SCL bcf STATUS,C movlw 0x08 movwf BR_BIT Loop_i2c bcf PORTA,SDA rlf FREQ2,F btfsc STATUS,C bsf PORTA,SDA bsf PORTA,SCL bcf PORTA,SCL decfsz BR_BIT,F goto Loop_i2c bcf STATUS,C movlw 0x08 movwf BR_BIT Loop_i3c bcf PORTA,SDA rlf FREQ1,F btfsc STATUS,C bsf PORTA,SDA bsf PORTA,SCL bcf PORTA,SCL decfsz BR_BIT,F goto Loop_i3c nop bcf PORTA,SCL bcf PORTA,EN2 nop bsf PORTA,SCL bcf PORTA,SCL return ;---------------------------------------------------------------- ;-------------------------------------------------------------- I2C_OUT_Tx bcf PORTA,EN3 bcf PORTA,SDA bcf PORTA,SCL nop bsf PORTA,EN3 nop bsf PORTA,SCL bcf PORTA,SCL bcf STATUS,C movlw 0x08 movwf BR_BIT Loop_i2c_Tx bcf PORTA,SDA rlf FREQ2,F btfsc STATUS,C bsf PORTA,SDA bsf PORTA,SCL bcf PORTA,SCL decfsz BR_BIT,F goto Loop_i2c_Tx bcf STATUS,C movlw 0x08 movwf BR_BIT Loop_i3c_Tx bcf PORTA,SDA rlf FREQ1,F btfsc STATUS,C bsf PORTA,SDA bsf PORTA,SCL bcf PORTA,SCL decfsz BR_BIT,F goto Loop_i3c_Tx nop bcf PORTA,SCL bcf PORTA,EN3 nop bsf PORTA,SCL bcf PORTA,SCL return ;************************************************************** ;* This routine initializes the LCD module * ;* Affects: * ;* TEMP - Returned with busy/address * ;************************************************************** LCDInit ;Initialize the LCD bsf STATUS,RP0 ;Select Register page 1 movlw 0x0F movwf TRISB ;RB7-4 output, RB3-0 input bcf STATUS,RP0 ;Select Register page 0 ;Cekaj visse od 15ms movlw .16 ;Setup call to SetupDelay movwf TEMP1 Loop_ini_1 movlw .0 ;Setup call to SetupDelay movwf TEMP call SetupDelay ;Each call to delay is decfsz TEMP1, F goto Loop_ini_1 movlw B'00110000' ;Set LCD to 4 bit interface movwf DAT nop bsf CNTRL,E ;toggle E for LCD nop bcf CNTRL,E ;Cekaj visse od 4.1ms movlw .6 ;Setup call to SetupDelay movwf TEMP1 Loop_ini_2 movlw .0 ;Setup call to SetupDelay movwf TEMP call SetupDelay ;Each call to delay is decfsz TEMP1, F goto Loop_ini_2 movlw B'00110000' movwf DAT nop bsf CNTRL,E ;toggle E for LCD nop bcf CNTRL,E call SetupDelay movlw B'00110000' ;Part of power-up sequence movwf DAT nop bsf CNTRL,E ;toggle E for LCD nop bcf CNTRL,E call SetupDelay movlw B'00100000' ;Set to 4 bit interface movwf DAT nop bsf CNTRL,E ;toggle E for LCD nop bcf CNTRL,E bsf STATUS,RP0 ;Select Register page 1 movlw 0xFF ;Set Port_B for input movwf TRISB bcf STATUS,RP0 ;Select Register page 0 ;Busy flag should be valid after this point movlw B'00101000' ;4bit interface, 2 lines call SendCmd ; of 5x7 characters movlw B'00001110' ;Display off, cursor off call SendCmd movlw B'00000001' call SendCmd movlw B'00000110' ;Set entry mode inc, no shift call SendCmd movlw B'10000000' ;Address DDRam upper left call SendCmd return ;--------------------------------------------------------------------- ; SEND CHAR Rutina za slanje karaktera na LCD ;--------------------------------------------------------------------- SendChar1 andlw 0x0F iorlw 0x30 SendChar movwf CHAR ;Character to be sent is in W call BusyCheck ;Wait for LCD to be ready bsf STATUS,RP0 ;Select Register page 1 movlw 0x0F movwf TRISB ;RB7-4 output, RB3-0 input bcf STATUS,RP0 ;Select Register page 0 movf CHAR,w andlw 0xF0 ;Get upper nibble movwf DAT ;Send data to LCD bcf CNTRL,RW ;Set LCD to read bsf CNTRL,RS ;Set LCD to data mode nop bsf CNTRL,E ;toggle E for LCD nop bcf CNTRL,E swapf CHAR,w andlw 0xF0 ;Get lower nibble movwf DAT ;Send data to LCD nop bsf CNTRL,E ;toggle E for LCD nop bcf CNTRL,E bsf STATUS,RP0 ;Select Register page 1 movlw 0xFF ;Set Port_B for input movwf TRISB bcf STATUS,RP0 ;Select Register page 0 return ;--------------------------------------------------------------------- ; SEND CMD Rutina za slanje komandi na LCD ;--------------------------------------------------------------------- SendCmd movwf CHAR ;Character to be sent is in W call BusyCheck ;Wait for LCD to be ready bsf STATUS,RP0 ;Select Register page 1 movlw 0x0F movwf TRISB ;RB7-4 output, RB3-0 input bcf STATUS,RP0 ;Select Register page 0 movf CHAR,w andlw 0xF0 ;Get upper nibble movwf DAT ;Send data to LCD bcf CNTRL,RW ;Set LCD to read bcf CNTRL,RS ;Set LCD to command mode nop bsf CNTRL,E ;toggle E for LCD nop bcf CNTRL,E swapf CHAR,w andlw 0xF0 ;Get lower nibble movwf DAT ;Send data to LCD nop bsf CNTRL,E ;toggle E for LCD nop bcf CNTRL,E bsf STATUS,RP0 ;Select Register page 1 movlw 0xFF ;Set Port_B for input movwf TRISB bcf STATUS,RP0 ;Select Register page 0 return ;--------------------------------------------------------------------- ; Rutina proverava busy flag na LCD ;--------------------------------------------------------------------- BusyCheck bcf CNTRL,RS ;Set LCD for Command mode bsf CNTRL,RW ;Setup to read busy flag nop bsf CNTRL,E ;Set E low nop nop movf DAT,W ;Read upper nibble busy flag, DDRam address ; andlw 0xF0 ;Mask out lower nibble ; movwf TEMP bcf CNTRL,E ;Toggle E to get lower nibble andlw 0xF0 ;Mask out lower nibble movwf TEMP nop bsf CNTRL,E nop nop swapf DAT,w ;Read lower nibble busy flag, DDRam address ; andlw 0x0F ;Mask out upper nibble ; iorwf TEMP,F ;Combine nibbles bcf CNTRL,E ;Set E high andlw 0x0F ;Mask out upper nibble iorwf TEMP, F ;Combine nibbles btfsc TEMP,7 ;Check busy flag, high = busy goto BusyCheck ;If busy, check again bcf CNTRL,RW return ;******************************************************************* ;* This routine is a software delay. * ;* At 4Mhz clock, the loop takes 3uS, so initialize TEMP with * ;* a value of 3 to give 9uS, plus the move etc should result in * ;* a total time of > 10uS. * ;******************************************************************* SetupDelay SD nop nop decfsz TEMP, F goto SD return ;******************************************************************* ;--------------------------------------------------------------------- BinBCD clrf R0 movwf R1 gtenth movlw .10 subwf R1,W btfss _C goto over movwf R1 incf R0 goto gtenth over retlw 0 ;---------------------------------------------------------------- ;--------------------------------------------------------------------- Print_SetUp movlw B'01000000' call SendCmd ;Definicija '.0' movlw 00 call SendChar movlw 00 call SendChar movlw 02 call SendChar movlw 05 call SendChar movlw 05 call SendChar movlw 05 call SendChar movlw 12 call SendChar movlw 00 call SendChar ;Definicija '.5' movlw 00 call SendChar movlw 00 call SendChar movlw 07 call SendChar movlw 04 call SendChar movlw 07 call SendChar movlw 01 call SendChar movlw 17 call SendChar movlw 00 call SendChar return ;---------------------------------------------------------------- ; Upis u EEPROM WR_EEPROM movwf EEDATA bsf STATUS,RP0 ; pg 1 bsf EECON1,WREN ; Omoguci upis u EEPROM movlw 0x55 ; Pocetak upisa movwf EECON2 ; / movlw 0xAA ; / movwf EECON2 ; / bsf EECON1,WR WO1 btfsc EECON1,WR ; Dali je zavrsen upis? goto WO1 bcf STATUS,RP0 ; pg 0 return ;--------------------------------------------------------------------- ; Citanje EEPROM RD_EEPROM bsf STATUS,RP0 ; pg 1 bsf EECON1,RD RO1 btfsc EECON1,RD ; Dali je zavrseno citane? goto RO1 bcf STATUS,RP0 ; pg 0 movf EEDATA,W return ;----------------------------------------------- EE_upis_Ch movlw .1 movwf EEADR movf C_Ch,W call WR_EEPROM return ;----------------------------------------------- EE_upis_VFO movlw .3 movwf EEADR movf C_VFO,W call WR_EEPROM return ;----------------------------------------------- EE_upis_Rx movlw .5 movwf EEADR movf C_Rx,W call WR_EEPROM return EE_upis_Tx movlw .7 movwf EEADR movf C_Tx,W call WR_EEPROM return EE_upis_MODE movlw .8 movwf EEADR movf MODE_B,W call WR_EEPROM return EE_upis_FUNC movlw .9 movwf EEADR swapf FLEG1,W andlw 0xF0 iorwf FUNC_B,W call WR_EEPROM return ;------------------------------------------------------------------------- Read_EEPROM ; Citanje podatka iz EEPROMA movlw .1 movwf EEADR call RD_EEPROM movwf C_Ch movlw .3 movwf EEADR call RD_EEPROM movwf C_VFO movlw .5 movwf EEADR call RD_EEPROM movwf C_Rx movlw .7 movwf EEADR call RD_EEPROM movwf C_Tx movlw .8 movwf EEADR call RD_EEPROM movwf MODE_B movlw .9 movwf EEADR call RD_EEPROM movwf FUNC_B swapf FLEG1,W movlw 0x0F andwf FUNC_B,F movlw 0x0F andwf FLEG1,F return ;------------------------------------------------------------------------- ;Ubacivanje pocetne vrednosti u EEPROM org 0x2100 ;Adresa EEPROM-a de .0,.7,.0,.54,.0,.144,.0,.96,.1,01 ;--------------------------------------------------------------------- END ; Proracun za PLL SAA1057 ; Q=4MHz 12,5kHz ;-------- WORD A --------------------------------------------- ; 15 bits: 512 <= Delitelj <= 32767 ;-------- WORD B --------------------------------------------- ; ZA PROBU '1111 1101 0000 0001' ; MSB LSB ; H=FDh L=01h ; ZA PROBU '1110 0011 0000 0001' ; MSB LSB ; H=E3h L=01h ; FM=1 REF=1 ; CP3 CP2 CP1 CP0 ; 0 0 0 0 0,023mA ; 0 0 0 1 0,07 mA ; 0 0 1 0 0,23 mA ; 0 1 1 0 0,7 mA ; 1 1 1 0 2,3 mA ; SB2=0 SLA=0 ; PDM1=0 PDM0=0 ; BRM=0 ; T3 T2 T1 T0 TEST (pin 18) ; 0 0 0 0 1 ; 0 1 0 0 Ref. frekvencija ; 0 0 0 1 Izlaz programibilnog brojacca ; 0 1 0 1 Izlaz in-lock (0=out-lock, 1=in-lock) ;----------------------------------------------------------- ; Simplex Rx = FREQ + COUNT - 10.7MHz ; Simplex Tx = FREQ + COUNT ; Duplex +/- Rx = FREQ + COUNT - 10.7MHz ; Duplex + Tx = FREQ + COUNT + 600 KHz ; Duplex - Tx = FREQ + COUNT - 600 KHz ; 600 KHz = 48 ; 10.7MHz = 856 (11520-856=10664) ; Tx: FREQH=45, FREQL=0 ; Rx: FREQH=41, FREQL=168 ; Ch00 144.000 MHz = 11520