View previous topic :: View next topic |
Author |
Message |
viknes1985
Joined: 11 Nov 2008 Posts: 24
|
Manchester Code Reader |
Posted: Thu Jan 22, 2009 9:16 am |
|
|
I don't know why the compiler couldn't recognize RBIF, RBIE, PORTB, TMR1IF, TMR1, CARRY, TMR1ON and also the asm. I left out anything? Please help guys. Thanks.[/code]
Last edited by viknes1985 on Fri Mar 20, 2009 12:25 pm; edited 1 time in total |
|
|
viknes1985
Joined: 11 Nov 2008 Posts: 24
|
follow up |
Posted: Thu Jan 22, 2009 9:17 am |
|
|
and the pragma also giving error statement..... |
|
|
FvM
Joined: 27 Aug 2008 Posts: 2337 Location: Germany
|
|
Posted: Thu Jan 22, 2009 10:54 am |
|
|
Yes, you have to modify the code according to CCS C syntax for interrupt functions and assembly statements. Also the SFR
definitions must be included. The device editor tool can make an include file automaticly.
Generally this kind of code is implementation dependant and not portable between different compilers. CCS C has built-in
functions for most operations in your code, but it works by direct SFR access as well. As with any port of low-level code,
you should check if anything is understood by CCS C correctly.
Code: | #include "PIC16F887_registers.h"
//...
#int_RB
void reader(void)
#asm
rlf STAC+7,f
rlf STAC+6,f
rlf STAC+5,f
rlf STAC+4,f
rlf STAC+3,f
rlf STAC+2,f
rlf STAC+1,f
rlf STAC+0,f
#endasm |
|
|
|
Guest
|
Where to get registers.h |
Posted: Sat Jan 24, 2009 1:15 pm |
|
|
Thanks for the reply FvM. By the way, where to get "PIC16F887_registers.h", i think i may need "PIC16F877a_registers.h" instead. Is this files are ready made, or i need to create my own *.h header file about the bits on INTCON?
Best Regards |
|
|
FvM
Joined: 27 Aug 2008 Posts: 2337 Location: Germany
|
|
Posted: Sun Jan 25, 2009 2:22 am |
|
|
Quote: | By the way, where to get "PIC16F887_registers.h" |
>
Quote: | The device editor tool can make an include file automaticly. |
|
|
|
viknes1985
Joined: 11 Nov 2008 Posts: 24
|
My compiler never add the header file |
Posted: Sun Jan 25, 2009 5:34 am |
|
|
Thanks for the reply FvM. But i still have errors on undefined identifier for RBIF, RBIE, PORTB, TMR1IF, TMR1, CARRY, TMR1ON. Any idea why my compiler can't compile? By the way, i'm using CCs C Compiler version 4.020 |
|
|
FvM
Joined: 27 Aug 2008 Posts: 2337 Location: Germany
|
|
Posted: Sun Jan 25, 2009 5:54 am |
|
|
The SFR definitions are apparently missing, e.g.:
Code: | #byte INTCON = 0x00B
#bit RBIF = INTCON.0 |
You can also add these definitions manually, using the SFR addresses from the datasheet. But Device Editor eases this operation, although it creates some double entries, that have to removed to make the file compile correctly. |
|
|
viknes1985
Joined: 11 Nov 2008 Posts: 24
|
Minor Problem |
Posted: Mon Jan 26, 2009 12:25 pm |
|
|
I'd include "#include <PIC16F887_registers.h>" and it does reduce the numbers of errors. Thanks to Frank who emailed me this header file. Since TMR1 is 32 bits, it's defined as "#word TMR1 = 0x00E" but the errors pop up saying it's undefined identifier. What's the problem?
Thanks in Advance |
|
|
FvM
Joined: 27 Aug 2008 Posts: 2337 Location: Germany
|
|
Posted: Mon Jan 26, 2009 2:17 pm |
|
|
The code compiled O.K. with PCM V4.084 |
|
|
viknes1985
Joined: 11 Nov 2008 Posts: 24
|
Cannot read |
Posted: Fri Jan 30, 2009 2:40 am |
|
|
The codes compiled ok after i upgrade to 4.084. But It's not working.... Maybe my idea was wrong on reading manchester code from U2270. Anyone have better idea on getting series of 1 and 0 from U2270. |
|
|
viknes1985
Joined: 11 Nov 2008 Posts: 24
|
Manchester decoding |
Posted: Sat Jan 31, 2009 11:55 pm |
|
|
Can done by fast io.... Using interrupt, it worst the condition
Last edited by viknes1985 on Fri Mar 20, 2009 12:24 pm; edited 1 time in total |
|
|
viknes1985
Joined: 11 Nov 2008 Posts: 24
|
anyone |
Posted: Fri Feb 06, 2009 9:14 am |
|
|
anyone can help me to find where's my code problem. Why it's not working? |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Fri Feb 06, 2009 12:07 pm |
|
|
Quote: | Is there any method to get the output in binary form? |
See the routines in this thread. They show how to display bytes or words
in binary format (1's and 0's):
http://www.ccsinfo.com/forum/viewtopic.php?t=29265 |
|
|
FvM
Joined: 27 Aug 2008 Posts: 2337 Location: Germany
|
|
Posted: Fri Feb 06, 2009 12:34 pm |
|
|
The binary data display problem has been already clarified in another thread (http://www.ccsinfo.com/forum/viewtopic.php?t=37595), so far the above code is legacy. However, it hasn't been ever said, what the actual problem with the code is supposed to be. |
|
|
viknes1985
Joined: 11 Nov 2008 Posts: 24
|
Stuck at here |
Posted: Wed Feb 25, 2009 10:02 pm |
|
|
Code: | #asm
rlf STAC+7,f
rlf STAC+6,f
rlf STAC+5,f
rlf STAC+4,f
rlf STAC+3,f
rlf STAC+2,f
rlf STAC+1,f
rlf STAC+0,f
#endasm |
this function not seems to work.... is there any other function to rotate this 8 bytes?
can used rotate_left or shift_left
Last edited by viknes1985 on Fri Mar 20, 2009 12:26 pm; edited 1 time in total |
|
|
|