verifying SEROUT?

nickwest

Member
Hi all,

I'm trying to get two 08Ms to communicate via serout/serin. I can't seem to get any serial output at all. Is is possible to put an LED or a piezo transducer across the serial output pin of the PICaxe... so that I'd get a flash or a chirp when the serial pulse is sent? I'd rather check it directly this way than via a PC serial terminal for simplicity!

Thanks
 

hippy

Ex-Staff (retired)
Yes, either a Piezo or LED+R ( I use 1K8 ) will chirp or flash when data sent. Make sure the LED works and is in the right way round, or you'll be as dumbfounded as I was on one occasion ;-)

For the LED, connect from Serial Out to 0V for Nxxxx baud rates or to +V with Txxxx baud rates, the Piezo doesn't really matter but ideally should be wired the same.

In fact I recommend putting a LED on the Download Serial Out, useful for seeing that SERTXD is happening even without the Terminal reading the data.
 

nickwest

Member
Hmmm, I'm not seeing anything. So far it's a very simple program with an interrupt to start it off - I can press a switch to (hopefully!) send the same SEROUT repeatedly. I have and LED flashing before & after the attempted SEROUT to make sure that this part of the program is being executed ie. pin1 goes high, then the serial burst, then pin1 high again to mark the end. But I detect nothing on pin4... Is there some error in the following code? (especially the SEROUT line!) Note that I am using 2 LEDs - one on pin1 to show the start and end of the serout command, and one on pin4 to flash while the serout is working....

setint %00001000,%00001000

main:
let b1 = 1 'any old seed will do for now
low 1
pause 500
goto main

interrupt:
high 1 'light an LED
pause 1000
low 1 'LED off while data is sent
serout pin4,n300,(85,85,85,"TEST",b1)
high 1 'LED on again to show data end
pause 1000
setint %00001000,%00001000
return
 

nickwest

Member
I should add - the LED on pin1 flashes as it should... on for 1second, off for a bit, on for 1second again... so I am pretty sure the interrupt is working and calling the relevant subroutine!
 

nickwest

Member
FIXED - I guess "pin4" in the serout line above is definitely NOT the same as simply the digit 4 to indicate the output pin!

Still a bit of a learning curve... hope I haven't wasted anyone's time!
 

inglewoodpete

Senior Member
Yes, pin4 is a reserved variable that reflects the value last read by the underlying operating system from the pin concerned. (Values will be 0 or 1). Your SerOut instruction will try to perform the output of serial data via either pin 0 or pin 1, depending on the state of system variable 'pin4'.

And yes, I've been caught out too <img src="wink.gif" width=15 height=15 align=middle>
 

Technical

Technical Support
Staff member
Make sure you are running the latest version of the software and have switched on the 'enhanced' compiler. This error will then be identified for you!

View&gt;Options&gt;Editor menu
 
Top