jonw0224
Full Member level 4
I program in Assembly. How do you guys use higher level languages for time critical applications since you don't know exactly how long the compiled code will take to execute? Here's a simple example:
using a PIC16F84 at 4 Mhz, you want to toggle RB0 every 10uS. In assembly, I may write:
How would I write it in PICBasic Pro or C?
What would the size be in terms of general registers used and program words? The assembly code is 0 registers and 10 program words.
using a PIC16F84 at 4 Mhz, you want to toggle RB0 every 10uS. In assembly, I may write:
Code:
bsf STATUS, RP0 ;bank 1
movlw B'11111110'
movwf TRISB ;set RB0 as output
bcf STATUS, RP0 ;bank 0
LOOPFOREVER:
movlw 1
xorwf PORTB, f ;toggle
goto $ + 1
goto $ + 1
goto $ + 1
goto LOOPFOREVER ;delay, loop = 10 cycles
How would I write it in PICBasic Pro or C?
What would the size be in terms of general registers used and program words? The assembly code is 0 registers and 10 program words.