Polymorphism
- Joined Aug 10, 2014
- 30
Besides the point. Show us the assembly code.Pretty simple!
Besides the point. Show us the assembly code.Pretty simple!
_Data ;TMR1 runs continuously |B0
bcf PIR1,CCP1IF ;flag must be cleared after mode change |B0
btfss PIR1,CCP1IF ;test CCP1 interrupt flag (interrupt not enabled)
goto $-1
movf CCPR1H,w ;start time high byte
movwf CCP_T1H ;save value in shadow register
movf CCPR1L,w ;start time low byte
movwf CCP_T1L ;save value in shadow register
bcf CCP1CON,0 ;change interrupt flag to falling edge
bcf PIR1,CCP1IF ;clear flag
btfss PIR1,CCP1IF ;test CCP1 falling edge interrupt flag
goto $-1
movf CCPR1H,w ;stop time high byte
movwf CCP_T2H ;save value in shadow register
It is not platform specific. That's the beauty of C.What level of chip is it written for? Presumably, your C must use the same instruction set (plus Assembly instructions) as our Assembly code.
You posted in a language I can't read. So, in plain English, French, or German, what exactly does your posted code do?
John
Your point must be that C generates exactly the same code.What would this look like in assembly?Rich (BB code):If (alpha == 1) { delta += 1; }
decf alpha, w
btfsc STATUS,2 ; skip if not zero
incf delta, f
If (alpha != 1)
{
delta += 1;
}
decfsz alpha, w
incf delta, f
If (alpha == 1)
{
delta += 1;
}
else
{
delta -= 1;
}
decfsz alpha, w
movlw 0xfe
incf WREG
addwf delta, f
Yes. If you know what you are doing in C, then it is on par with assembly in terms of execution speed.Your point must be that C generates exactly the same code.
Can you please show us the assembly code generated by your micro c compiler for that code snippet, please?Yes. If you know what you are doing in C, then it is on par with assembly in terms of execution speed.
Well, run these 3 examples through the C compiler, post what it does, and then we can compare to human-written assembler code and draw conclusions.Yes. If you know what you are doing in C, then it is on par with assembly in terms of execution speed.
I would, but all I have is an smart phone for the internet.Well, run these 3 examples through the C compiler, post what it does, and then we can compare to human-written assembler code and draw conclusions.
Then posting assembler code was total wasteI would, but all I have is an smart phone for the internet.
Not really. The OP has Mikro C too.Then posting assembler code was total waste
To me Assembler rather is AssmeblerThen posting assembler code was total waste
Yeah, it really was!Not really.NorthGuy said:Then posting assembler code was total waste
OP wrote the above.Dear all,
Lately I have been working with some projects where timing is critical and hence have decided to learn how to write more efficient code.
Can you direct me some where or give some pointers regarding things like multiplication, division and ANY other ways of making my code run faster. I am using MikroC pr for PIC.
Best regards
Hey look I do know how to write an argument at University level but where is the ******* money to do it?Yeah, it really was!
You asked for assembly code so that you could "argue a point" then you posted a conclusion without argument (premises and proof) and you say you don't have the tools to argue the point. Isn't that called "trolling"?
That excuse can't possibly be valid.Hey look I do know how to write an argument at University level but where is the ******* money to do it?
I haven't made a dollar since 2005.That excuse can't possibly be valid.
How much money are you making doing your "thing" here?
John
by Jake Hertz
by Jake Hertz
by Jake Hertz