Mercurial > public > hwos_code
comparison src/eeprom_rs232.asm @ 628:cd58f7fc86db
3.05 stable work
author | heinrichsweikamp |
---|---|
date | Thu, 19 Sep 2019 12:01:29 +0200 |
parents | c40025d8e750 |
children | 237931377539 |
comparison
equal
deleted
inserted
replaced
627:bf5fee575701 | 628:cd58f7fc86db |
---|---|
1 ;============================================================================= | 1 ;============================================================================= |
2 ; | 2 ; |
3 ; File eeprom_rs232.asm combined next generation V3.03.1 | 3 ; File eeprom_rs232.asm combined next generation V3.04.3 |
4 ; | 4 ; |
5 ; Internal EEPROM, RS232 | 5 ; Internal EEPROM, RS232 |
6 ; | 6 ; |
7 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved. | 7 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved. |
8 ;============================================================================= | 8 ;============================================================================= |
88 movlw 0x55 | 88 movlw 0x55 |
89 movwf EECON2 | 89 movwf EECON2 |
90 movlw 0xAA | 90 movlw 0xAA |
91 movwf EECON2 | 91 movwf EECON2 |
92 bsf EECON1,WR | 92 bsf EECON1,WR |
93 bsf INTCON,GIE ; ...but the flag for the ISR routines were still set, so they will interrupt now! | |
94 | 93 |
95 write_eep2: | 94 write_eep2: |
96 btfsc EECON1,WR | 95 btfsc EECON1,WR |
97 bra write_eep2 ; wait about 4ms... | 96 bra write_eep2 ; wait about 4ms... |
98 bcf EECON1,WREN | 97 bcf EECON1,WREN |
98 bsf INTCON,GIE ; ...but the flag for the ISR routines were still set, so they will interrupt now! | |
99 return | 99 return |
100 | 100 |
101 ;============================================================================= | 101 ;============================================================================= |
102 | 102 |
103 IFDEF _external_sensor | 103 IFDEF _external_sensor |
106 disable_ir_s8: | 106 disable_ir_s8: |
107 banksel TXSTA2 ; select bank for IO register access | 107 banksel TXSTA2 ; select bank for IO register access |
108 clrf TXSTA2 | 108 clrf TXSTA2 |
109 clrf RCSTA2 | 109 clrf RCSTA2 |
110 banksel common ; back to bank common | 110 banksel common ; back to bank common |
111 bcf ir_power ; IR off | 111 bcf ir_power ; IR off |
112 bcf mcp_power ; power-down instrumentation amp | 112 bcf mcp_power ; power-down instrumentation amp |
113 bsf s8_npower ; power-down S8 digital interface | 113 bsf s8_npower ; power-down S8 digital interface |
114 bcf s8_digital_avail ; digital S8 interface not available | 114 bcf s8_digital_avail ; digital S8 interface not available |
115 return | 115 return |
116 | 116 |
117 | 117 |
118 global enable_ir_s8 | 118 global enable_ir_s8 |
119 enable_ir_s8: | 119 enable_ir_s8: |
136 btfss ir_power | 136 btfss ir_power |
137 bra $-6 | 137 bra $-6 |
138 return | 138 return |
139 | 139 |
140 enable_s8: | 140 enable_s8: |
141 ; Check for Digital/Analog | 141 banksel TXSTA2 ; select bank for IO register access |
142 bsf s8_npower ; power-down S8 HUD | |
143 WAITMS d'1' ; very short delay | |
144 bsf mcp_power ; power-up instrumentation amp | |
145 btfss mcp_power | |
146 bra $-6 | |
147 banksel TXSTA2 ; select bank for IO register access | |
148 clrf TXSTA2 | 142 clrf TXSTA2 |
149 clrf RCSTA2 | 143 clrf RCSTA2 |
150 banksel common ; back to bank common | 144 banksel common ; back to bank common |
145 ; Check for Digital/Analog | |
146 bsf s8_npower ; power-down S8 HUD | |
147 WAITMS d'2' ; very short delay | |
148 bsf mcp_power ; power-up instrumentation amp | |
149 btfss mcp_power | |
150 bra $-4 | |
151 | 151 |
152 ; It may be digital, check for voltage when isolator is powered | 152 ; It may be digital, check for voltage when isolator is powered |
153 bcf s8_npower ; power S8 HUD | 153 bcf s8_npower ; power S8 HUD |
154 WAITMS d'1' ; wait 1 ms | 154 WAITMS d'1' ; wait 1 ms |
155 btfsc PORTG,2 ; RX2=1? | 155 btfsc PORTG,2 ; RX2=1? |
188 call request_speed_normal ; request CPU speed change to normal speed | 188 call request_speed_normal ; request CPU speed change to normal speed |
189 enable_rs232_1: | 189 enable_rs232_1: |
190 btfss speed_is_normal ; speed = normal? | 190 btfss speed_is_normal ; speed = normal? |
191 bra enable_rs232_1 ; NO - wait for ISR to adjust speed | 191 bra enable_rs232_1 ; NO - wait for ISR to adjust speed |
192 bcf PORTE,0 ; start comm | 192 bcf PORTE,0 ; start comm |
193 bsf PORTJ,2 ; /Reset (for very old OSTC sport) | |
193 ;initialize serial port1 (TRISC6/7) | 194 ;initialize serial port1 (TRISC6/7) |
194 movlw b'00100100' ; BRGH=1, SYNC=0 | 195 movlw b'00100100' ; BRGH=1, SYNC=0 |
195 movwf TXSTA1 | 196 movwf TXSTA1 |
196 movlw b'10010000' | 197 movlw b'10010000' |
197 movwf RCSTA1 | 198 movwf RCSTA1 |
202 disable_rs232: | 203 disable_rs232: |
203 clrf RCSTA1 | 204 clrf RCSTA1 |
204 clrf TXSTA1 ; UART disable | 205 clrf TXSTA1 ; UART disable |
205 bcf PORTC,6 ; TX hard to GND | 206 bcf PORTC,6 ; TX hard to GND |
206 bsf PORTE,0 ; stop comm | 207 bsf PORTE,0 ; stop comm |
208 bcf PORTJ,2 ; /Reset (for very old OSTC sport) | |
207 return | 209 return |
208 | 210 |
209 | 211 |
210 global rs232_wait_tx | 212 global rs232_wait_tx |
211 rs232_wait_tx: | 213 rs232_wait_tx: |