Mercurial > public > hwos_code
comparison src/eeprom_rs232.asm @ 650:bc214815deb2
3.19/10.75 release
author | heinrichsweikamp |
---|---|
date | Sun, 28 Aug 2022 13:13:38 +0200 |
parents | aeca5717d9eb |
children | 75e90cd0c2c3 |
comparison
equal
deleted
inserted
replaced
649:ef2ed7e3a895 | 650:bc214815deb2 |
---|---|
67 movwf EECON2 ; ... | 67 movwf EECON2 ; ... |
68 bsf EECON1,WR ; start write operation | 68 bsf EECON1,WR ; start write operation |
69 write_eeprom_loop: | 69 write_eeprom_loop: |
70 btfsc EECON1,WR ; write completed? | 70 btfsc EECON1,WR ; write completed? |
71 bra write_eeprom_loop ; NO - loop waiting | 71 bra write_eeprom_loop ; NO - loop waiting |
72 btfsc EECON1,WRERR ; All ok? | |
73 rcall write_eeprom_error ; NO, something failed. | |
72 bcf EECON1,WREN ; YES - disable writing | 74 bcf EECON1,WREN ; YES - disable writing |
73 bsf INTCON,GIE ; - re-enable interrupts | 75 bsf INTCON,GIE ; - re-enable interrupts |
74 return ; - done | 76 return ; - done |
75 | 77 write_eeprom_error: |
78 bsf eeprom_write_error_flag ; Set error flag | |
79 ; Try again (once) | |
80 movlw 0x55 ; unlock sequence | |
81 movwf EECON2 ; ... | |
82 movlw 0xAA ; ... | |
83 movwf EECON2 ; ... | |
84 bsf EECON1,WR ; start write operation | |
85 write_eeprom_loop2: | |
86 btfsc EECON1,WR ; write completed? | |
87 bra write_eeprom_loop2 ; NO - loop waiting | |
88 return | |
89 | |
76 | 90 |
77 ;----------------------------------------------------------------------------- | 91 ;----------------------------------------------------------------------------- |
78 ; EEPROM read and write Functions to be used via Macros | 92 ; EEPROM read and write Functions to be used via Macros |
79 ; | 93 ; |
80 global eeprom_read_common | 94 global eeprom_read_common |
498 ble2_configure: | 512 ble2_configure: |
499 rcall enable_rs232 | 513 rcall enable_rs232 |
500 bcf NCTS ; Clear to send | 514 bcf NCTS ; Clear to send |
501 call wait_1s | 515 call wait_1s |
502 call wait_1s | 516 call wait_1s |
517 call wait_1s | |
518 call wait_1s | |
503 bcf PORTB,6 | 519 bcf PORTB,6 |
520 nop | |
504 bsf PORTB,6 ; rising edge -> Command mode | 521 bsf PORTB,6 ; rising edge -> Command mode |
505 | 522 |
506 ; point to config table | 523 ; point to config table |
507 movlw LOW ble_AT1 | 524 movlw LOW ble_AT1 |
508 movwf TBLPTRL | 525 movwf TBLPTRL |
543 ble_AT1: ; config table | 560 ble_AT1: ; config table |
544 ; 0xFF at the end | 561 ; 0xFF at the end |
545 ; 0xFE: 20ms delay | 562 ; 0xFE: 20ms delay |
546 ; 0xFD: 1s delay | 563 ; 0xFD: 1s delay |
547 ; .13: cr character | 564 ; .13: cr character |
548 db 0xFD,0xFD ; Wait 2 seconds | 565 db 0xFD,0xFD,0xFD,0xFD ; Wait 4 seconds |
549 db "AT+UDSC=0,0",.13,0xFE,0xFE ; Disable SPP Server on ID0 (and wait 40ms) | 566 db "AT+UDSC=0,0",.13,0xFE,0xFE ; Disable SPP Server on ID0 (and wait 40ms) |
550 db "AT+UDSC=0,3",.13,0xFE,0xFE ; SPP Server on ID0 (and wait 40ms) | 567 db "AT+UDSC=0,3",.13,0xFE,0xFE ; SPP Server on ID0 (and wait 40ms) |
551 db "AT+UDSC=1,0",.13,0xFE,0xFE ; Disable SPS Server on ID1 (and wait 40ms) | 568 db "AT+UDSC=1,0",.13,0xFE,0xFE ; Disable SPS Server on ID1 (and wait 40ms) |
552 db "AT+UDSC=1,6",.13,0xFE,0xFE ; SPS Server on ID1 (and wait 40ms) | 569 db "AT+UDSC=1,6",.13,0xFE,0xFE ; SPS Server on ID1 (and wait 40ms) |
553 db "AT&W",.13,0xFE ; write settings into eeprom (and wait 20ms) | 570 db "AT&W",.13,0xFE ; write settings into eeprom (and wait 20ms) |