Pulse IN and Pulse Out

MikePembo

New Member
Hi,
I would like 2 08M s to communicate with each other via the pulse in and pulse out commands. they will be sending commands to each other like:

( where w2 will equal 1-65535)
to read the pulse:

Code:
pulsin 0,1,w2
and to send the pulse:
Code:
pulsout 0,w2
They will only be sending these commands about every 20ms.
Will the PICAXE 08Ms be able to communicate easily because in simulation it does not work very well? :confused:

Any help would be greatly appreciated!
Thanks,
Mike
 

MikePembo

New Member
Thanks for the reply but I have no breadboards and I have already developed the PCBs. I think the code is correct but I was wondering if anyone had any experience in pulse in and out between PICAXEs?
 

MikePembo

New Member
Thanks for the reply but I have no breadboards and I have already developed the PCBs. I think the code is correct but I was wondering if anyone had any experience in pulse in and out between PICAXEs?
Should have made clearer, I have sent off for the PCBs and can't test properly until they arrive and I received a message from the supplier that the stock has run out and there will be a delay in delivery.
 

alband

Senior Member
There is no reason (that I can see) why that code shouldn't work. In the simulator the program with "pulsin" in it wont work too well because only one program can work at a time and it can't actually simulate the circuitry. It will be a lot easier and almost definitely possible to solve any problems once you have the circuits.

If you have any query regarding the PCB's themselves then make sure to post the schematics but if they are bought products meant for this then they should work.

As SS says though, why not use "serin" and "serout"? (p168 manual 2)
 

MikePembo

New Member
serin/out

As SS says though, why not use "serin" and "serout"? (p168 manual)
I can't use the serin and serout as I am using them to control the PICs and then the output will differ depending on what I send via serin.

Also the simulator I am using is Yenka PICs.

Just wondering, what speed should I put the PICAXEs at? If they are at normal speed will they misread the pulsin? (I'm asking this because they will be working at 0.00001 (I think) of a second.

(Seems unbelievable they can tell the difference between a 0.00001 pulse and a 0.00002 pulse!)

Thanks,
Mike
 

SilentScreamer

Senior Member
Serial can be used on any input or output, wherever pulseout/in can be used serial can too.

I have never used pulse in/out so I can comment on its reliability however if you are still going to use pulsein/out I'd use larger pulses if possible, a 1ms pulse is certain to fail, 10ms pulses and checking across a range of +/-5ms would be far more reliable.
 

MikePembo

New Member
Serial can be used on any input or output, wherever pulseout/in can be used serial can too.

I have never used pulse in/out so I can comment on its reliability however if you are still going to use pulsein/out I'd use larger pulses if possible, a 1ms pulse is certain to fail, 10ms pulses and checking across a range of +/-5ms would be far more reliable.
Maybe I should switch to using 2 serials then? (I have always believed that PICAXEs only had one serin and one serout per chip)

Thanks for all your help,
Mike
 

MikePembo

New Member
Serial Output

Hi (again),
I am now programming for it (using serial). I have the code here for serial input:

Code:
serin 0, N2400, w6, w4
e.g.
serin Pin, Speed, Qualifier, Variable to save data
Is this correct?

I am outputting this data from a computer

how does the output look when you output it. (Is the qualifier sent before the variable?):confused: (I am programming in Visual basic 2008)

This is what I have for the output:

SerialPort1.WriteLine("35526") 'Qualifier
SerialPort1.WriteLine("21357") 'Variable
 
Last edited:

MikePembo

New Member
Input PIN 3

Also what input pin should I use? (I do not want to use input 3 as it requires a diode). What about Pin 4? If I use this pin, do I need to state that it is an input pin at the start of my PICAXE code? If so, how do I do that?
Thanks,
Mike
 

SilentScreamer

Senior Member
Look at the "let dirs" command I can't remember the syntax off the top of my head. You could you serin/serout on the same pin for both connections with a different qualifier for each.

This is how the code you posted should look:

Code:
serin 0,N2400,(w6,w4)
Alternatively you can use a constant qualifier i.e.

Code:
serin 0,N2400,("UU",w4)
 

alband

Senior Member
Code:
serin 0,N2400,(qualifier),variable
I'm not sure about VB, I've only ever received data, so hopefully someone else will know, but you are trying to simulate exactly the "serout" command.

The qualifier is in front of everything. You can use pin4 without needing to set it as an input, the command "serin" will do that.

As for pin3 needing I diode, I've never heard of that, are you sure?

Check the BASIC commands manual for serin and serout, it will tell you everything you need.
 

SilentScreamer

Senior Member
As for pin3 needing I diode, I've never heard of that, are you sure?
I had heard of it but never had need to used it so I wasn't sure, I checked and it is in manual 2 page 170.

PICAXE-08/08M/14M - Due to the internal structure of input3 on these chips, a
1N4148 diode is required between the pin and V+ for serin to work on this
particular pin (‘bar’ end of diode to V+) with this circuit. All other pins have an
internal diode.
PICAXE-20M/20X2 - Due to the internal structure of input6 (C.6) on this chip, a
1N4148 diode is required between the pin and V+ for serin to work on this
particular pin (‘bar’ end of diode to V+) with this circuit. All other pins have an
internal diode.
I also have never sent data to a PICAXE using vb, others will probably be able to answer with regard to that.
 

MikePembo

New Member
I don't think it matters what i am programming in, but I was asking HOW you send the qualifier? (Is it on a completely different line or is it on the same line as the variable.
 

SilentScreamer

Senior Member
It can be either I think, although it might as well be the same one. The below code sends two "U"s (binary 01010101) as a qualifier then w4. The quotation marks state that it is an ASCII character.

Code:
serin 0,N2400,("UU",w4)
 

hippy

Ex-Staff (retired)
Sending qualifiers plus data is just like sending any other data so can be sent in the one command, split over two commands, spread over many, or sent a byte at a time in a suitable loop.

Receiving is the same, however it is advisable to make it a single command as this will maximise execution speed.
 
Top