Ok i've been up all night playing with this, thanks for helping me with the constant thing (I think i'll move it to eeprom if i have a chance) Anyways now I have another problem here is the code:
Cash and Cost are both Words
hCost is Byte1 of Cost and lCost is byte0
debugin [Temp[0],Temp[1],hCost,lCost] 'Receive 4 Bytes
Cost=~Cost Rev 16 'Invert Cost and rev bits
Cash=~Cash Rev 16 'Invert Cash and rev bits
Cash = Cash - Cost ' Subtract Cost from Cash
Cash=~Cash Rev 16 're invert Cash
debug hCash,lCash 'Send both bytes out serially
This code takes a 4 byte instruction where the last two bytes is a cost which for now is fixed at $00 $FA. All this info is recieved inverted so i need to Not the variable and reverse the bits. The problem I'm having is that lets say I set Cash to be $11C6, when I run this code it outputs $11CC, It gets the last byte correct, $CC however the $11 should be $10. Any ideas?
Bookmarks