My guess is that ... 99.99% of the time is spent in the PAUSE 499 statement.
So if anything does come in via the USART in the interrupt during that time, the byte received will be immediately discarded with the mybyte=0 statement that follows.
<br>
My guess is that ... 99.99% of the time is spent in the PAUSE 499 statement.
So if anything does come in via the USART in the interrupt during that time, the byte received will be immediately discarded with the mybyte=0 statement that follows.
<br>
DT
Ok, so I stripped that bit out - only this bit remains...
yet when I press the "1" key on my PC keyboard...nothing happens (ie I don't see "Got it!" on my terminal, which seems very apt as I really don't get it!)Code:loop: if mybyte="1" then hserout ["got it!"] mybyte = 0 endif goto loop
??
Last edited by HankMcSpank; - 17th June 2009 at 14:05.
Which pin are you connected to for RX?
It looks like you are trying to set RB6 as INPUT, as if that were the RX pin.
But RX is on RB5.
<br>
DT
That's a good spot. The config part (setting up ports etc), was a straight lift (cut/paste) from a non-interrupt based HSERIN test program that I have which works fine. You are quite right that on a 16f690 PIC, the RX pin is RB5
Fortunately, I am actually connecting to RB5 for my RX (& like I say, I have a program where the whole HSERIN/HSEROUT kit & kaboodle works with that same config). I guess this is where I 'got lucky' & the PIC has defaulted RB5 to being an input? So alas, I don't think that's my problem
I actually think the port setup, registers etc are ok (on account it being a straight cut/paste from an HSERIN/HSEROUT worker) ...what I think this is likely to be is a lack of understanding what I should be matching against? (ie if mybyte="1" then what does a key press "1" get stored in a byte as etc)
Last edited by HankMcSpank; - 17th June 2009 at 14:32.
DOH IT WORKS!!!!!
The Solution?![]()
(not sure I should even say, but rather try flam it off as an ahem "a very technical issue")
I'm using a Pickit2 as my pseudo VT terminal ...I've hardwired a switch on the low pin count demo board which allows me to go from programmer mode to VT emulator mode (saves having to buy MAX232 + other components & can also use the USB cable for the PC-PIC serial comms etc - http://www.picbasic.co.uk/forum/show...1&postcount=21 ) ....sometimes, if I don't flick the switch back from VT terminal mode to programmer mode in time (while PicBasic Pro is compiling), the Pickit2 app then tries to auto update the PIC with the new HEX - but doesn't see it (becuase I never flicked the switch in time) & everything locks up. This necessitates closing the Pickit2 application down & restarting it.
So, I'd become so focused on the code, that I'd overlooked that when I have to restart the Pickit2 app, that I need to tick the 'apply VCC' box to power up the PIC
Therefore in summary...this last hurdle was nothing more sinister that my Pic not having any power applied to it from the Pickit2 ....(I reckon my original problems were nailed with the formatting problems)
I'm chuffed to bits - I can't thank you all enough - I'm now off to make some LEDs light up when I press PC keys. My 2yr old son won't be happy as Thomas the Tank Engine has just started & I'll be saying things to him like "hehe... hey son, look at this LED light up - it's all interrupt based you know?". Two year olds of today - they know nothing.
Last edited by HankMcSpank; - 17th June 2009 at 15:05.
Bookmarks