pulsin problem

Yessir

Member
I am using a PICAXE-18X mounted on a SD21 servo control board. I am trying to read inputs from 4 channels of a Futaba radio control receiver using PULSIN and then control servo outputs accordingly.

The problem that I am having is I can only read pulses on inputs 0, 1 & 2. I am unable to read pulses on either of the other two inputs 6 or 7.

I have tried swapping the receiver channels round to confirm that it is sending pulses on all 4 channels which appears to work OK. I have also connected a microswitch to inputs 6 & 7 and confimed that they are switching high / low. I have also tried using COUNT to see if there are any pulses on inputs 6 & 7 but once again this did not work. Timing should not be the problem because I am reading the inputs sequentially with a 2 - 3 second pause between each PULSIN statement.


Does anybody have any suggestions what I am doing wrong?
 

hippy

Ex-Staff (retired)
This works for me, counting ~19021 on any of the input pins when linked to Output Pin 3, zero when disconnected 18X Firmware 8.8 ....

pwmout 3,50,100
do
count 7,1000,w0
sertxd(#w0,CR,LF)
Loop
 

BeanieBots

Moderator
Sounds like a logic level problem.
The inputs which are working have different thresholds to the other two (6 & 7).
They "should" work but it might be that your receiver output is too low for it to be seen by those inputs.
Do you have a 'scope which you can use to check the logic levels with?

It could also be that your receiver supply voltage is a bit lower than your PICAXE supply voltage. Run them both off the same supply and see what happens.
 

Dippy

Moderator
Seems the most sensible explanation.

Yessir, does any of the above make any sense to you?

Briefly:-
PIC chips have input pins and some have a slightly different internal arrangement. This affects the levels that it can sense as high and low.
Some are called TTL and some are called Schmitt Trigger or ST.
Don't worry about the 'silicon', just remember they have different voltage 'threshold' values where they think the signal is High or Low.

From PIC DataSheet when the supply power is @5V.
Input sensed as high:-
TTL is min 2.0V
ST is min 4.0V

So, if you had a pulse coming in that was 3.0V in amplitude, for example, then this would be considered 'high' on a TTL input (as it is higher than 2V) but still considered as Low on an ST input (e.g. Inputs 6&7) as it is below 4V.

If the pulse from your external device is only reaching 3V, for example, this explains why it ain't being detected.
Hence, why someone suggested a scope.

(Note: 'scopes can be expensive for something really decent, but if you are planning on taking electronics seriously it should really be on your list to Santa).


(There is more to this, so a browse the Microchip Data Sheet. People should have copies in their lavvies).

This effect can also happen when doing serial from a device running at 3V to PICAXE @5V.

Hippy:
I REALLY WOULD SUGGEST that a note in the PICAXE Manual would be very handy - assuming anybody read it of course :)
Maybe a nice little graphic to explain it too.
Maybe WestAust can provide us with one..?

it could be crucial information - especially if someone thinks they have a duff PICAXE, when in reality thats just the way it is.
 

Yessir

Member
Thanks for the information - I think that the received signal voltage is the problem. According to Futabas FAQ site most modern receivers are regulated at about 3.3 volts which means that pin 6 & 7 are not going to see the pulses.

I assume that I can use the receiver signal to trigger a transistor on the input side which in turn would provide a pulse using the PICAXE voltage? Does anybody have a suitabe circuit?

Thanks.
 

tiscando

Senior Member
Do the 18X's schmitt-trigger inputs (6,7) behave like a cmos schmitt trigger (in schmitt-trigger nand gates, and schmitt-trigger invertors)?
In a 74hc14, and a cmos 40106 schmitt-trigger invertor, @VDD=5V, the output is triggered low when the the input voltage reaches above 3V, and triggered high when it falls below 2V.
I got confused when Dippy said that the ST input is sensed high when above 4V. :confused:
ST is min 4.0V
EDIT: It appears that Microchip calls them schmitt-trigger inputs with ViH=4V, ViL=1V, but they are not proper schmitt-trigger buffers (are they?), so a better term for them would be "CMOS inputs".
 
Last edited:

Dippy

Moderator
Got confused?
Mmmm.... well why not look at the PIC Data Sheet?
There is a TABLE that shows the specific electrical performance.

If you want the spec of a 16F88 then look at the Data Sheet for 16F88.

Why look at something different?

To use a hippyesque analogy, that's like looking at a Skoda brochure when trying to choose which Jaguar to buy ;)
 
Top