FLAGS work ONLY with LCDOUT...
DragonFire, did you set the TRISF as well? unless PORTF.1=0 won't do anything as the default setting for PORTF 'should' be input ... yeah i love guessing
So OR you set TRISF.1 = 0 at the top of your code, OR you can use LOW PORTF.1. LOW/HIGH will do it for you.
It's up to you.
NOW, you can't use PULSIN/PULSOUT as you did, PULSOUT is not working in background, so it will finish to do it's job, then your program will execute PULSIN. As the pulse is already gone, it won't read it.
Of course, an interrupt would do the trick... of course with DT instant interrupt, not PBP ON INTERRUPT.
What i figure to be working, in your ISR, you start a timer, you change the interrupt trigger type (rising/falling edge), then at the next interrupt, you read the Timer value.
Still possible to use the CCP module... it's design for it.
I suggest you to read the following Tips 'n Tricks doc of Microchip. It's all there
http://ww1.microchip.com/downloads/e...Doc/41214a.pdf
EDIT: i saw you READ/WRITE to the same pin (ultra)?
SEROUT2 should be used with DEC modifier instead of #... maybe this is why you have some weird character.
I heard some LCD may need some CR or LF character to work properly.. not sure if this could apply to yours.
Last edited by mister_e; - 22nd May 2007 at 15:37.
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Bookmarks