Help needed for PC-controlled Wireless Notice Board on USART
I'm doing a project on wireless notice board, and my codes are in assembly language
1. The wireless module is zigbee, and it's from pc to PIC,
2. The display is dot-matrix and data will be taken from EEPROM to be displayed
3. Only one way communication using USART from Zigbee to PIC6f628A
4. PIC will receive new data whenever available from ZigBee and store in EEPROM
5. The PC will be sending data through a ZigBee transmitter to the receiver.
So, currently I've got my display unit to work and everything, and can display 128 characters. All of which is pre-loaded into the EEPROM.
I'm having trouble with the communications part. How do I use USART to receive a data string and store into EEPROM one byte at a time? Plus I don't want to do the polling method.
Attached is the codings that i've written.
1. The original code is working fine and i need to embed the USART part into it
2. The Usart RC file is the one I've written for serial communication with ZigBee that needs to be embedded.
The code should work as: Displaying out data from EEPROM and when new data is received, it will take it and store into EEPROM and then start displaying all over again. Please help. Thanks
Here is the Usart part:
org 0x04 ;interrupt service vector movwf W_Save movf STATUS,W clrf STATUS movwf STATUS_Save movf PCLATH,W movwf PCLATH_Save movlw 0x00 movwf eefile goto RCINT movf PCLATH_Save movwf PCLATH,W movf STATUS_Save movwf STATUS,W movf W_Save retfie ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; movlw 0xC0 ;setting up the interrupt, goes into the main part movwf INTCON movlw 0x00 movwf PIR1 movlw 0x68 bsf STATUS,RP0 movwf SPBRG movlw 0xA0 movwf PIE1 bcf TXSTA,BRGH bcf TXSTA,SYNC bcf STATUS.RP0 bsf RCSTA,SPEN bsf RCSTA,CREN bcf RCSTA,RX9 bsf STATUS,RP0 movlw 0x02 movwf TRISB ;RB1 is the rx pin end ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; RCINT movf RCREG,W bsf STATUS,RP0 movwf EEDATA bcf STATUS,RP0 movf eefile bsf STATUS,RP0 movwf EEADR bcf STATUS,RP0 call write incf eefile,F movf eefile bsf STATUS,RP0 movwf EEDATA movlw 0x7F movwf EEADR bcf STATUS,RP0 call write bcf PIR1,RCIF retfie write bsf STATUS,RP0 ;select bank1 ;writes it to EEPROM bsf EECON1,WREN ;enable write bcf INTCON,GIE movlw 0X55 ;unlock codes movwf EECON2 movlw 0xAA movwf EECON2 bsf EECON1,WR ;write begins bsf INTCON.GIE bcf STATUS,RP0 ;select bank0 writeA btfss PIR1,EEIF ;wait for write to complete goto writeA bcf PIR1,EEIF bsf STATUS,RP0 ;select bank1 bcf EECON1,WREN ;disable other writes bcf STATUS,RP0 ;select bank0 retlw 00