timer and others fundtions

yunie68

New Member
Hello :)

First, I'm sorry if my English is bad, I'm a French student (in electronic) and I have to realize a project to success my exam so it's very very important for me :(. I searched on the net to find a solution to my problem and this forum seems to be the best to help me.
I'll try to explain my project ..

I use a pic 16f88, in input I have two electrics signals. I'll treat every single signal one after the other. I have to do the same thing with both signals so i'll explain with only one of them.
I have to mesure how long the signal is on high level and compare it with a value (1,5ms).
If the signal's high level is longer than 1.5ms then I have to send the same signal on output 1 and a low level (0) on output 2.
If the signal's hign level is shorter than 1.5ms then I have to send the same signal on output 2 and 0 n output 1.

I think it would be simple for someone who knows Picaxe but I don't ... and my teacher doesn't really help me...
I hope you will understand my problem even if my english is very bad... If it's too bad to understand the problem you can contact me at this e-mail address :
yunie68@hotmail.fr

Thank you very much,
Mary.
 

Andrew Cowan

Senior Member
You say you are using a PIC16F88 - is this a 'raw' microchip PIC, or does it have the PICAXE bootloader on it?

Have you written any programs to it yet?

Andrew
 

yunie68

New Member
I don't know what a "raw microship" is ...
All I can say is that I program on Picaxe, then I connect a cable (almost the same that connect the screen to the computer).
My pic is on an electronic card that I realized, I connect the cable straight on it.

Yes I already made a program for my pic but it was just to test it...
My program put on or off two LEDS wich are on my electronic card.

I hope this will help you to help me :D:p

Thank you,
Mary
 

Andrew Cowan

Senior Member
Have a look at the pulsin and pulsout commands in manual 2 - these should do what you want.

Pulsin measures the length (in uS) and stores it in a variable (b1?)
You can then use an if statment to see if it is longer than 1.5ms (150uS).
You can then use pulsout to output the same signal.

Andrew
 

yunie68

New Member
Ok thank you !
I can't do this right now because I'm at home and don't have Picaxe here (don't know where to find it...) But i'll connect to this forum tomorrow at school and try it ! :)

Thank you again it's really nice !
 

yunie68

New Member
Hi !
So I'm at school and I searched for the pulsin function in manual 2.
it give for exemple :
Code:
pulsin 3,1,w1
I understand what "3" and "w1" is but what's the "1"?
 

SilentScreamer

Senior Member
Hi !
So I'm at school and I searched for the pulsin function in manual 2.
it give for exemple :
Code:
pulsin 3,1,w1
I understand what "3" and "w1" is but what's the "1"?
If the 1 is a 1 then the plusin command will start when the pin is high.

If the 1 is a 0 then the plusin command will start when the pin is low.
 

yunie68

New Member
Ok thank you !

I Tried this code:

Code:
main:
pulsin 2,1,w1
if w1 > 2000 then sup
if w1 < 2000 then inf
goto main

sup:
low 6
high 7
goto main

inf:
low 7
high 6
goto main
but in the simulation 6 is always high whatever if 2 is high or low... i don't understand..
 

Andrew Cowan

Senior Member
That is because you are not able to replicate such short pulses in the simulator. With an actual circuit, the above code should work.

pulsin 2,1,w1 starts counting when pin2 goes high, and stops when it goes low.

The value you need to use for 1.5mS = 150.

A
 

Technical

Technical Support
Staff member
pulsin takes the value typed in the 'generic' input box, so you can actually enter any value here. A useful tip is to place a breakpoint on the pulsin line, this gives you time to change the value before continuing the simulation.
 
Top