-
What does "does not work" mean?
If all the PORTB-pins are 0, you might not have set them up as digital pins. Try
ANSEL=ANSELH=0;
before modifying the register (ANSELH is the important one for PORTB, see datasheet):
If you assign tmp to PORTB, the hardware overwrites all bits and you are fine.
If you clear individual bits, the hardware executes read-modify-write and -- unfortunately -- all...
2009-11-13 14:59:38 UTC in Small Device C Compiler
-
Hi,
you can use
#define BIT_SET(VAR, BIT) VAR |= (1
2009-11-13 10:31:59 UTC in Small Device C Compiler
-
Great to hear that it works now.
One note: Assigning each pin separately costs you one instruction cycle (4 clocks) and a bit of code memory (at least one instruction, sometimes more due to bank switching). Using
TRISC = 0b11110000;
PORTC = 0b00001010;
while (1)
{
PORTC ^= 0b00001111;
delayms(100);
}
instead should save you a bit of both. Of...
2009-11-08 16:32:50 UTC in Small Device C Compiler
-
main (void)
{
TRISC0 = 0;
TRISC1 = 0;
TRISC2 = 0;
TRISC3 = 0;
// snip
}
You probably just miss `ANSEL=0; ANSELH=0;` as part of your initialization code -- otherwise the ports are configured as analog inputs and will read as 0 (see datasheet D41262E for the pic16f690, page 34, footnote 4).
As BSF/BCF/XORWF are implemented as read-modi.
2009-11-08 15:12:23 UTC in Small Device C Compiler
-
tecodev committed revision 5568 to the Small Device C Compiler SVN repository, changing 2 files.
2009-11-05 23:11:10 UTC in Small Device C Compiler
-
tecodev committed revision 5567 to the Small Device C Compiler SVN repository, changing 2 files.
2009-11-04 23:42:35 UTC in Small Device C Compiler
-
You might need to add --use-stdout to the arguments to sdcc as well, like
`sdcc --use-stdout myfile.c > output.txt`.
2009-10-29 22:33:31 UTC in Small Device C Compiler
-
defi_electronique.c:25: error 20: Undefined identifier 'PORTAbits'
This is quite correct: PORTAbits is defined as PORTA_bits in , as is the case for all _bits-structure definitions for all devices supported by the pic14 target.
Just insert an underscore before the bits-suffix and everything should be fine.
Best regards
Raphael.
2009-09-20 20:59:01 UTC in Small Device C Compiler
-
I think the workaround is work around a compiler bug and not *the* solution. I'd agree to keep this item open for others to find more easily.
2009-09-13 10:51:53 UTC in Small Device C Compiler
-
Followup:
Fixed in the libraries distributed with sdcc 2.9.2, r5509.
2009-08-31 08:57:56 UTC in Small Device C Compiler