Page 2 of 2

Re: Timer 1 for 12F675

Posted: Wed Mar 07, 2012 3:35 am
by 1Handypal
Hello guys and gals(if any),
I have not been able to test anything out yet. Thanks to all for your valuable input and support.
I might have a chance tonight and will let you know the results.
Best.

Re: Timer 1 for 12F675

Posted: Thu Mar 08, 2012 8:19 am
by 1Handypal
Hello all again,
Unfortunately this interrupt thing is not working right. I tried different ways and still could not get it to work correctly. It seems flaky/unstable/unpredictable.
I am tired of this meaningless battle over a simple matter, honestly. Simple things work, but as soon as you take it to a bit more complex - run into trouble.
Here is file attached.
Compiler returns multiple errors:
............\12F675_exp2.c(69): error: error in built-in assembly
............\12F675_exp2.c(70): error: error in built-in assembly
............\12F675_exp2.c(71): error: error in built-in assembly
.............\12F675_exp2.c(72): error: error in built-in assembly
.............\12F675_exp2.c(73): error: error in built-in assembly
12F675_exp2.c success

failure

Return code = 1
As soon as you comment all lines in C Code box - it all compiles successfully. I suspect something is loose within that FCD file...
Could somebody look into it? Thanks in advance.
Best.

Re: Timer 1 for 12F675

Posted: Thu Mar 08, 2012 10:04 am
by medelec35
Hi
Your getting errors because lines of assembly code your adding is in the wrong format.

For example you have got

Code: Select all

asm TRISIO 0x08;
Whereas is should be
asm
{

movlw 08h //Place 1000 into W
movwf _trisio //Move 1000 onto TRISA - set GP3 to i/p others to o/p

}

You can use:

Code: Select all

asm  movlw 08h 
asm movwf _trisio
But you will need precede with

Code: Select all

asm
on every line.
Normally with assembly and other compilers you will need to change to bank1 before writing to registers like _trisio
However with BoostC compiler, it's automatically done for you.
That's why I have left bank function off.

With assembly you need to move a literal value into working register (W).
Then move contents of W into Special Function Registors SFR.
You precede SFR with an underscore.

Not sure why you need to do this as with the last 12F675 I posted is allowing pic to work correctly.
If you don't think that's the case, then I can look into the issue.

Using Flowchart I have posted:
12F675GP3 port Test with GP1 WPU.fcf

If that works 100% of the time, which it does in my case, then I would be more inclined to look at the flowchart it'self

You need to bear in mind that Flowchart simulation is so much slower than hardware.

Therefore you may not always get the expected results.

Start simple to test functions first, then build up from that.

Martin

Re: Timer 1 for 12F675

Posted: Thu Mar 08, 2012 2:51 pm
by Steve
Hello,

Because this is a V4 issue, I have moved the topic to the V4 forum.