But my understanding is that PULSIN and PULSOUT only applies to PORT B.
Is there a way that RC pulses can be read into PORT A?
Can it indeed be done on the PIC16F84 with the PICBASIC compiler?
Appreciate your time and help with this.
Where'd you get that info?
PulsIn/PulsOut doesn't have those restrictions.
If the pin can be read, you can use PulsIn.
If the pin can be written, you can use PulsOut.
It's all in the PBP manual.
And are you using PicBasic (PBC) or PicBasicPro (PBP)?
And which version?
That info. was gleaned from "PIC BASIC - An Introduction" (Neil Edwards & Jasper Roberts). Apologies, I thought I'd already stated the compiler is PICBASIC (PBC).
The PULSIN / PULSOUT commands work fine with PORT B, but not with PORT A. I'm looking to store five R/C channels on each of the five Port A pins, before routing them to PORT B.
From the above postings I've learnt how to get the needed servo reverse action (thanks), but how do you get the RC pulse on PORT A when PBC doesn't recognise PULSIN for that port?
Well, we don't know for sure which PIC you're using (you hinted at the 16F84, but never really specified)...but...
As far as PBC, yep, you sure did mention it... I missed it. My bad.
And PBC is limited in that respect, Pin 0 - Pin 7, that's what you get. Maybe Pin 8 will get you PortA.0. I don't know, I don't use PBC.
If you want my advice, get the upgrade to PBP. You'll be MUCH happier in the long run.
Short of that, don't use the pulsin statement ('cause PBC won't let you).
Write your own tight loop to mock pulsin.
Wait for the pin to go high (or low)
Sit in a tight loop counting the passes thru the loop while the pin is high (or low)
Exit when the pin changes again.
Take the loop count, multiply it by the # of us spent in each loop, and you've got your answer...
OR...
Use the pulsin on the PortB, and use a delay loop to send the 'pulsout' on PortA.
'Fraid you're waaaay over me now.
I've downloaded the PBP demo version and the code in your first post works great. But the project calls for five seperate pulses on each pin of PORT A (running on a PIC16F84, BTW).
Adding a few more lines to your original code just isn't working. Re:
Pulse0 VAR WORD
Pulse1 VAR WORD
Pulse2 VAR WORD
Pulse3 VAR WORD
Pulse4 VAR WORD
Main:
PulsIn PORTA.0, 1, Pulse0
PulsIn PORTA.1, 1, Pulse1
PulsIn PORTA.2, 1, Pulse2
PulsIn PORTA.3, 1, Pulse3
PulsIn PORTA.4, 1, Pulse4
PulsOut PORTB.0, Pulse0
PulsOut PORTB.1, Pulse1
PulsOut PORTB.2, Pulse2
PulsOut PORTB.3, Pulse3
PulsOut PORTB.4, Pulse4
GoTo Main
End
Works fine with just one servo, but as soon as the extra code is added, nothing happens at all.
Would you be interested in commiting yourself to help with this? You obviously have the wherewithal to do this stuff, but I wouldn't expect your help for free. Care to name your price?
Hi, Martin
Do you know these tiny inverters are VERY simple to build with CMOS circuits ???
TONS of circuit schemes are available on the web ...
Note those gadgets also are available as ready to use devices from R/C manufacturers ... if you're ready to pay for.
I can't believe you have to "invert" all the 5 channels at the same time ...
Alain
************************************************** ***********************
Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
************************************************** ***********************
IF there is the word "Problem" in your question ...
certainly the answer is " RTFM " or " RTFDataSheet " !!!
*****************************************
Look in the manual under 'DEFINE PULSIN_MAX'
I get the feeling that your code is getting 'hung up' waiting for a pulsin, and it doesn't happen, or it's just not arriving when you want it to. Pulsin times out and returns 0 for a value.
If you limit your pulsin to 3ms (DEFINE PULSIN_MAX 300 @ 4Mhz will limit pulsin to 3ms), the program might work like you want it to. But then you have to add some 'error checking' code. I.E., if the pulsin timed out, don't output the 'dead' value, re-output the old value, something along those lines.
Bookmarks