06-25-2015, 05:56 AM
(06-25-2015, 05:51 AM)Segolia Wrote:no...it's a PIC16F877a on a SK40C board with a 4MHz clock, I'm trying to have 5 LED light up(and down) in one direction and when a switch is pressed the LED lights up in the opposite direction,(06-25-2015, 05:31 AM)SCN-3_NULL Wrote: I'm not sure but I think I cant use
for delay in assembly language, any better alternatives? or a better way for the pins to send output in sequence?Code:
__delay_ms(500)
It's just a convenience function. You gotta do it yourself in assembly which means busy-waiting (throw the processor into a fixed length loop). To work out the time you need to bust out the data sheet and find out the clock speed, work out the number of cycles your loop takes and do some magic (my minds a bit hazy on the specifics atm).
As for sending things serially? Does your device have something like UART? You should use that.
so everything should be in the assembly code, which I have trouble with