|
|
View previous topic :: View next topic |
Author |
Message |
joshkeys
Joined: 16 Aug 2005 Posts: 37 Location: Fredericton,NB
|
i2c_isr_state() question conerncing ASM |
Posted: Wed Aug 17, 2005 3:51 pm |
|
|
Hi there.. this is more of an ASM question then anything.. but i was trying to see what the i2c_isr_state() function did and one thing i dont get is line 00CC where it moves W to F register 53. If i look at the symbol table it says that 0x0053 = @I2C_STATE.
To me this implies that @I2c_STATE is register that holds an 8 bit value of the I2c state.. but how do i get access to the information concerning each of the bits in this register, as on line 00CA you see bit 7 is set. I am just curious what it all means.
.................... state = i2c_isr_state();
00C2: BTFSC FC7.5
00C4: BRA 00CC
00C6: CLRF 53
00C8: BTFSC FC9.0
00CA: BSF 53.7
00CC: MOVF 53,W
00CE: INCF 53,F
00D0: MOVWF xD5
Thanks
Josh |
|
|
Ttelmah Guest
|
|
Posted: Thu Aug 18, 2005 2:58 am |
|
|
Hint.
In PIC asembler, the source is the left value, and the destination the right. The routine checks the status of bit 5 in the SSPSTAT register (the data/address flag), and then clears address 53 if the last byte was an address. If it was an address, it then checks the bottom bit, to see if this is a read, or write command, and sets the top bit of '53', if the 'write' bit is set. The contents of '53', are what is returned by the function, being copied into 'W', incremented, and copied to address D5, which is the 'return' value.
As you can see, only the top bit is explicitly controlled by the code. In the example, it shows you that the top bit is used to determine the data direction required on the transfer.
Best Wishes |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|