diff options
author | Christian Pointner <equinox@mur.at> | 2012-06-07 17:34:39 +0000 |
---|---|---|
committer | Christian Pointner <equinox@mur.at> | 2012-06-07 17:34:39 +0000 |
commit | 06c643e22a9c5c6d5e8b4139403f2d25700c0f67 (patch) | |
tree | cfa620bfb520071d2863f534954ddc164942bcb4 | |
parent | better Port Pin definitions (diff) |
improved hardware definitions
git-svn-id: https://svn.spreadspace.org/mur.sat@510 7de4ea59-55d0-425e-a1af-a3118ea81d4c
-rw-r--r-- | software/ihu/i2c.inc | 56 | ||||
-rw-r--r-- | software/ihu/ihu.asm | 82 | ||||
-rw-r--r-- | software/ihu/temp.inc | 22 | ||||
-rw-r--r-- | software/ihu/ttx.inc | 36 |
4 files changed, 98 insertions, 98 deletions
diff --git a/software/ihu/i2c.inc b/software/ihu/i2c.inc index de79836..85d323f 100644 --- a/software/ihu/i2c.inc +++ b/software/ihu/i2c.inc @@ -31,33 +31,33 @@ ;; ------------------------------------- i2c_start bsf STATUS,RP0 - bcf TRISB,I2C_SDA + bcf I2C_SDA nop - bcf TRISB,I2C_SCL + bcf I2C_SCL bcf STATUS,RP0 return ;; ------------------ i2c_restart bsf STATUS,RP0 - bsf TRISB,I2C_SDA + bsf I2C_SDA nop - bsf TRISB,I2C_SCL + bsf I2C_SCL nop nop nop - bcf TRISB,I2C_SDA + bcf I2C_SDA nop - bcf TRISB,I2C_SCL + bcf I2C_SCL bcf STATUS,RP0 return ;; ------------------ i2c_stop bsf STATUS,RP0 - bsf TRISB,I2C_SCL + bsf I2C_SCL nop - bsf TRISB,I2C_SDA + bsf I2C_SDA bcf STATUS,RP0 return @@ -69,27 +69,27 @@ i2c_send_byte bsf STATUS,RP0 i2c_send_byte_next btfss I2C_BYTE,7 - bcf TRISB,I2C_SDA + bcf I2C_SDA btfsc I2C_BYTE,7 - bsf TRISB,I2C_SDA + bsf I2C_SDA nop - bsf TRISB,I2C_SCL + bsf I2C_SCL nop nop - bcf TRISB,I2C_SCL + bcf I2C_SCL rlf I2C_BYTE,f decfsz I2C_BIT_CNT,f goto i2c_send_byte_next nop nop - bsf TRISB,I2C_SDA - bsf TRISB,I2C_SCL + bsf I2C_SDA + bsf I2C_SCL bcf STATUS,RP0 movf PORTB,w bsf STATUS,RP0 - bcf TRISB,I2C_SCL - bcf TRISB,I2C_SDA + bcf I2C_SCL + bcf I2C_SDA bcf STATUS,RP0 andlw b'00010000' movwf I2C_BYTE @@ -102,18 +102,18 @@ i2c_recv_byte movlw .8 movwf I2C_BIT_CNT bsf STATUS,RP0 - bsf TRISB,I2C_SDA + bsf I2C_SDA i2c_recv_byte_loop - bsf TRISB,I2C_SCL + bsf I2C_SCL bcf STATUS,RP0 - btfsc PORTB,I2C_SDA + btfsc I2C_SDA bsf I2C_BYTE,0 bsf STATUS,RP0 - bcf TRISB,I2C_SCL + bcf I2C_SCL decfsz I2C_BIT_CNT,f goto i2c_recv_byte_next - bcf TRISB,I2C_SDA + bcf I2C_SDA bcf STATUS,RP0 return @@ -125,23 +125,23 @@ i2c_recv_byte_next ;; ------------------ i2c_ack bsf STATUS,RP0 - bcf TRISB,I2C_SDA - bsf TRISB,I2C_SCL + bcf I2C_SDA + bsf I2C_SCL nop nop - bcf TRISB,I2C_SCL + bcf I2C_SCL bcf STATUS,RP0 return ;; ------------------ i2c_nack bsf STATUS,RP0 - bsf TRISB,I2C_SDA - bsf TRISB,I2C_SCL + bsf I2C_SDA + bsf I2C_SCL nop nop - bcf TRISB,I2C_SCL - bcf TRISB,I2C_SDA + bcf I2C_SCL + bcf I2C_SDA bcf STATUS,RP0 return diff --git a/software/ihu/ihu.asm b/software/ihu/ihu.asm index 487d8e0..d8bf6d5 100644 --- a/software/ihu/ihu.asm +++ b/software/ihu/ihu.asm @@ -41,43 +41,43 @@ ;; I/O Pins ;; PortA -SOLAR_C0 EQU 0 -SOLAR_C1 EQU 1 -SOLAR_C2 EQU 2 -SOLAR_C3 EQU 3 -OWIRE EQU 4 -SOLAR_C4 EQU 5 +#define SOLAR_C0 PORTA,0 +#define SOLAR_C1 PORTA,1 +#define SOLAR_C2 PORTA,2 +#define SOLAR_C3 PORTA,3 +#define OWIRE PORTA,4 +#define SOLAR_C4 PORTA,5 ;; PortB -DTMF_INT EQU 0 -BAT_V EQU 1 -SOLAR_V EQU 2 -BAT_C EQU 3 -I2C_SDA EQU 4 -I2C_SCL EQU 5 -RTC_INT EQU 6 -RTC_RST EQU 7 +#define DTMF_INT PORTB,0 +#define BAT_V PORTB,1 +#define SOLAR_V PORTB,2 +#define BAT_C PORTB,3 +#define I2C_SDA PORTB,4 +#define I2C_SCL PORTB,5 +#define RTC_INT PORTB,6 +#define RTC_RST PORTB,7 ;; PortC -MPU_PWRDWN EQU 0 -MPU_RESET EQU 1 -UNDEF_C2 EQU 2 -UNDEF_C3 EQU 3 -UNDEF_C4 EQU 4 -UNDEF_C5 EQU 5 -MPU_TX EQU 6 -MPU_RX EQU 7 +#define MPU_PWRDWN PORTC,0 +#define MPU_RESET PORTC,1 +#define UNDEF_C2 PORTC,2 +#define UNDEF_C3 PORTC,3 +#define UNDEF_C4 PORTC,4 +#define UNDEF_C5 PORTC,5 +#define MPU_TX PORTC,6 +#define MPU_RX PORTC,7 ;; PortD -DTMF_D0 EQU 0 -DTMF_D1 EQU 1 -DTMF_D2 EQU 2 -DTMF_D3 EQU 3 -DTMF_PWRDWN EQU 4 -TTX_RESET EQU 5 -TTX_SCL EQU 6 -TTX_SDA EQU 7 +#define DTMF_D0 PORTD,0 +#define DTMF_D1 PORTD,1 +#define DTMF_D2 PORTD,2 +#define DTMF_D3 PORTD,3 +#define DTMF_PWRDWN PORTD,4 +#define TTX_RESET PORTD,5 +#define TTX_SCL PORTD,6 +#define TTX_SDA PORTD,7 ;; PortE -SOLAR_C5 EQU 0 -SOLAR_C6 EQU 1 -SOLAR_C7 EQU 2 +#define SOLAR_C5 PORTE,0 +#define SOLAR_C6 PORTE,1 +#define SOLAR_C7 PORTE,2 ;; variables ;; page 0 only @@ -215,19 +215,19 @@ int_dtmf_end int_tmr1 decfsz DTMF_TIMEOUT,f goto int_tmr1_end - bsf PORTD,DTMF_PWRDWN + bsf DTMF_PWRDWN bcf T1CON,TMR1ON movlw DTMF_BUF movwf DTMF_BUF_PTR clrf DTMF_CS - bcf PORTD,DTMF_PWRDWN + bcf DTMF_PWRDWN int_tmr1_end bcf PIR1,TMR1IF goto interrupt_end int_rtc - btfsc PORTB,RTC_RST + btfsc RTC_RST call rtc_init goto int_rtc_end @@ -316,7 +316,7 @@ init clrf PORTB - bcf PORTD,DTMF_PWRDWN + bcf DTMF_PWRDWN movlw DTMF_BUF movwf DTMF_BUF_PTR clrf DTMF_CS @@ -325,16 +325,16 @@ init movlw b'00110000' movwf T1CON - bcf PORTD,TTX_SCL - bcf PORTD,TTX_SDA + bcf TTX_SCL + bcf TTX_SDA nop - bcf PORTD,TTX_RESET ;reset TTX + bcf TTX_RESET ;reset TTX clrf TMR0 bsf INTCON,GIE clrf TMP - bsf PORTD,TTX_RESET + bsf TTX_RESET goto main ;; ------------------------------------- diff --git a/software/ihu/temp.inc b/software/ihu/temp.inc index f0ec683..6c9504d 100644 --- a/software/ihu/temp.inc +++ b/software/ihu/temp.inc @@ -45,13 +45,13 @@ TEMP_CMD_L_CNT EQU H'41' ;; ------------------------------------- owire_presence bsf STATUS,RP0 - bcf TRISA,OWIRE + bcf OWIRE movlw .161 movwf OWIRE_CNT owire_presence_loop decfsz OWIRE_CNT,f goto owire_presence_loop - bsf TRISA,OWIRE + bsf OWIRE bcf STATUS,RP0 movlw .21 movwf OWIRE_CNT @@ -71,9 +71,9 @@ owire_response_loop ;; ------------------------------------- owire_write1 bsf STATUS,RP0 - bcf TRISA,OWIRE + bcf OWIRE nop - bsf TRISA,OWIRE + bsf OWIRE bcf STATUS,RP0 movlw .20 movwf OWIRE_CNT @@ -85,13 +85,13 @@ owire_write1_loop ;; ------------------------------------- owire_write0 bsf STATUS,RP0 - bcf TRISA,OWIRE + bcf OWIRE movlw .21 movwf OWIRE_CNT owire_write0_loop decfsz OWIRE_CNT,f goto owire_write0_loop - bsf TRISA,OWIRE + bsf OWIRE bcf STATUS,RP0 return @@ -113,14 +113,14 @@ owire_write_loop ;; ------------------------------------- owire_readbit bsf STATUS,RP0 - bcf TRISA,OWIRE + bcf OWIRE nop - bsf TRISA,OWIRE + bsf OWIRE bcf STATUS,RP0 nop - btfss PORTA,OWIRE + btfss OWIRE bcf OWIRE_BYTE,7 - btfsc PORTA,OWIRE + btfsc OWIRE bsf OWIRE_BYTE,7 movlw .17 movwf OWIRE_CNT @@ -161,7 +161,7 @@ temp_init_error ;; ------------------------------------- temp_read_value - bcf PORTA,OWIRE + bcf OWIRE call owire_presence btfsc OWIRE_BYTE,0 goto temp_read_value_error diff --git a/software/ihu/ttx.inc b/software/ihu/ttx.inc index 79b52ca..8fa1479 100644 --- a/software/ihu/ttx.inc +++ b/software/ihu/ttx.inc @@ -31,7 +31,7 @@ ;; ------------------------------------- ttx_send_byte bsf STATUS,RP0 - bcf TRISD,TTX_SDA + bcf TTX_SDA bcf STATUS,RP0 movwf TTX_BYTE xorwf TTX_CSUM,f @@ -39,10 +39,10 @@ ttx_send_byte movwf TTX_BIT_CNT ttx_send_next_bit btfsc TTX_BYTE,7 - bsf PORTD,TTX_SDA + bsf TTX_SDA btfss TTX_BYTE,7 - bcf PORTD,TTX_SDA - bsf PORTD,TTX_SCL + bcf TTX_SDA + bsf TTX_SCL nop nop nop @@ -55,7 +55,7 @@ ttx_send_next_bit nop nop nop - bcf PORTD,TTX_SCL + bcf TTX_SCL nop nop nop @@ -76,7 +76,7 @@ ttx_send_next_bit decfsz TTX_BIT_CNT,f goto ttx_send_next_bit bsf STATUS,RP0 - bsf TRISD,TTX_SDA + bsf TTX_SDA bcf STATUS,RP0 return @@ -85,7 +85,7 @@ ttx_recv_byte movlw .8 movwf TTX_BIT_CNT ttx_recv_next_bit - bsf PORTD,TTX_SCL + bsf TTX_SCL nop nop nop @@ -98,7 +98,7 @@ ttx_recv_next_bit nop nop nop - bcf PORTD,TTX_SCL + bcf TTX_SCL nop nop nop @@ -120,9 +120,9 @@ ttx_recv_next_bit nop nop rlf TTX_BYTE,f - btfsc PORTD,TTX_SDA + btfsc TTX_SDA bsf TTX_BYTE,0 - btfss PORTD,TTX_SDA + btfss TTX_SDA bcf TTX_BYTE,0 decfsz TTX_BIT_CNT,f goto ttx_recv_next_bit @@ -142,9 +142,9 @@ ttx_send_frame movwf TTX_BYTE andlw b'00001111' movwf TTX_BYTE_CNT - bsf PORTD,TTX_SCL + bsf TTX_SCL movlw .3 - bcf PORTD,TTX_SCL + bcf TTX_SCL call wait_ms clrf TTX_CSUM @@ -187,13 +187,13 @@ ttx_send movwf TXREG call ttx_break - bsf PORTD,TTX_SDA + bsf TTX_SDA bsf STATUS,RP0 - bcf TRISD,TTX_SDA + bcf TTX_SDA bcf STATUS,RP0 btfss TTX_BYTE,0 - bcf PORTD,TTX_SDA - bsf PORTD,TTX_SCL + bcf TTX_SDA + bsf TTX_SCL nop nop nop @@ -206,7 +206,7 @@ ttx_send nop nop nop - bcf PORTD,TTX_SCL + bcf TTX_SCL nop nop nop @@ -223,7 +223,7 @@ ttx_send nop nop bsf STATUS,RP0 - bsf TRISD,TTX_SDA + bsf TTX_SDA bcf STATUS,RP0 movf TTX_BYTE,w return |