PDA

View Full Version : OWIN not jumping to label



MOUNTAIN747
- 15th March 2011, 16:32
I’m trying to get a OWOUTcommand to jump to a label when there is no sensor present. I have two ports on a 16F873a using 1-Wire to read DS2438 battery monitors. If there is no sensor present I want to jump to a label. I have verified that on an empty port, the master sends the reset pulse but there is no presents pulse. The program does not jump to a label as expected. On a port where there is a sensor the program works as it should. Am I setting up the command correctly to jump to a label if sensor is not present? There is no example of this in the manual. Comments Please! Thanks...


Sensor:
OWOUT OWnet,1, [skiprom,WriteScratchpad,$00,$00],Senout
OWOUT OWnet,1, [skiprom,ConvertT] :pause 10
OWOUT OWnet,1, [skipROM,ConvertV] :pause 5
OWOUT OWnet,1, [skipROM,RecallMemory, $00] ; Skip ROM search, Recall Memory
OWOUT OWnet,1, [skipROM,ReadScratchpad, $00] ; Skip ROM search, Read
OWIN OWnet,2, [STR DSbuffer\9]' Read 9 bytes
Serout2 TX_485, 84,[" 1-Wire is present on main"]
GOSUB GetT_V
Senout:
RETURN
ALT_Sensor:
OWOUT OWalt,1, [skiprom,WriteScratchpad,$00,$00],Altout
OWOUT OWalt,1, [skiprom,ConvertT] :pause 10
OWOUT OWalt,1, [skipROM,ConvertV] :pause 5
OWOUT OWalt,1, [skipROM,RecallMemory, $00]
OWOUT OWalt,1, [skipROM,ReadScratchpad, $00] ' Skip ROM search, Read
OWIN OWalt,2, [STR DSbuffer\9]' Read 9 bytes
Serout2 TX_485, 84,[" 1-Wire is present on Alternet"]
GOSUB GetT_V
Altout:
RETURN

Darrel Taylor
- 16th March 2011, 23:06
I've checked the 1-wire presence with a different PIC and different 1-wire device, and it seems to be working ok.

I noticed the point that your program jumps to doesn't give any indication that it jumped there.
Maybe you could try something like this for testing purposes.


Sensor:
OWOUT OWnet,1, [skiprom,WriteScratchpad,$00,$00],Senout
OWOUT OWnet,1, [skiprom,ConvertT] :pause 10
OWOUT OWnet,1, [skipROM,ConvertV] :pause 5
OWOUT OWnet,1, [skipROM,RecallMemory, $00] ; Skip ROM search, Recall Memory
OWOUT OWnet,1, [skipROM,ReadScratchpad, $00] ; Skip ROM search, Read
OWIN OWnet,2, [STR DSbuffer\9]' Read 9 bytes
Serout2 TX_485, 84,[" 1-Wire is present on main"]
GOSUB GetT_V
RETURN

Senout:
Serout2 TX_485, 84,[" 1-Wire presence NOT DETECTED!"]
RETURN

MOUNTAIN747
- 17th March 2011, 15:30
Thanks Darrel for taking the time to look at this. My indication of a jump or no jump was the Serout message. It there was a jump there would be no message on that port. The fact that you tested OK on another PIC tell me something, at least I have the OWOUTcommand set up right. I'll keep testing and post any new findings.