
Originally Posted by
Mus.me
... ,but i wanted to know how i write the pulse to 4017 ...
OK, so let's take a look at the PULSOUT command.
There's really nothing wrong with your original statement, which is why we were avoiding the question.
Code:
pulsout portb.0,150
The pulsout line above will toggle the pin twice, giving an effective "Pulse". The 4017 will count on the "Rising Edge" of the pulse.
The time between the Toggles would be 150 * 10us = 1500us = 1.5ms. (assuming 4mhz OSC)
1.5ms is extremely long for this purpose. But it would still work.
pulsout portb.0,1 with a 10us pulse would work just as well.
However, the 4017's can take a pulse width as small as 100ns (.1us) so you don't really need PULSOUT.
Simply toggling the pin with HIGH and LOW will do the job too.
Code:
HIGH PORTB.0
LOW PORTB.0
Another thing to do is turn OFF all LED's before the pulse. Otherwise the 5 LED pattern will briefly show on 2 rows, giving a ghosting effect.
Code:
PORTA = %11111 ; ALL LED's OFF
HIGH PORTB.0
LOW PORTB.0
porta = %10010 ; new pattern
Cheers,
Bookmarks