Author |
Message |
Topic: Float to byte conversion |
mkuang
Replies: 3
Views: 4908
|
Forum: General CCS C Discussion Posted: Mon Aug 30, 2010 7:23 am Subject: Float to byte conversion |
You mean just keep the integer part of it?
You can do:
unsigned char my_integer;
float my_float;
.
.
.
my_integer = (unsigned char) my_float;
|
Topic: Why my OCMJ4X8C-15 LCD doesn't work, and LCD no display |
mkuang
Replies: 30
Views: 36833
|
Forum: General CCS C Discussion Posted: Tue Aug 17, 2010 7:33 am Subject: Why my OCMJ4X8C-15 LCD doesn't work, and LCD no display |
Does your code actually compile without errors.
I don't think you can declare pointers to constants the way you did. |
Topic: WDT doesn't work |
mkuang
Replies: 11
Views: 13048
|
Forum: General CCS C Discussion Posted: Tue Aug 17, 2010 7:08 am Subject: WDT doesn't work |
This:
setup_timer_2(T2_DIV_BY_16, 499, 1);
Timer2 is 8 bits. I don't know what happens if you set it to 499, but it certainly doesn't help. |
Topic: port B interrupt on changes int not clearing |
mkuang
Replies: 17
Views: 36278
|
Forum: General CCS C Discussion Posted: Tue Aug 03, 2010 3:26 pm Subject: port B interrupt on changes int not clearing |
#int_rb only detects change on RB4 to RB7. You are trying to detect a change on RB2 so it doesn't seem like that is the right interrupt. Your PIC does have separate IOC (interrupt-on-change) for all t ... |
Topic: Compiler bug with setup_adc_ports in v4.109 |
mkuang
Replies: 2
Views: 4525
|
Forum: General CCS C Discussion Posted: Tue Aug 03, 2010 9:59 am Subject: Compiler bug with setup_adc_ports in v4.109 |
Looks like you are right. |
Topic: Uart Framing Problems |
mkuang
Replies: 3
Views: 6171
|
Forum: General CCS C Discussion Posted: Tue Aug 03, 2010 8:14 am Subject: Uart Framing Problems |
This:
putc(0x01);
Does not output a readable ASCII character. Why don't you try something like putc('A') instead.
Where are you enabling the transmit and receive interrupts? |
Topic: PIC16F877A: Need to use timer0 int with serial data input |
mkuang
Replies: 4
Views: 6592
|
Forum: General CCS C Discussion Posted: Tue Aug 03, 2010 7:11 am Subject: Re: PIC16F877A: Need to use timer0 int with serial data inpu |
I am making a display with 32 leds and 12 7 segments that are driven from Port B and controlled by Port A with 4-16 decoders so the display is very time sensitive but I also have to receive data from ... |
Topic: Watch Crystal App |
mkuang
Replies: 5
Views: 6421
|
Forum: General CCS C Discussion Posted: Tue Aug 03, 2010 7:05 am Subject: Watch Crystal App |
First thing, if the crystal load capacitance is specified as 12pF, you do _not_ want 12pF capacitors.....
The crystal 'sees' as it's load, the two external capacitors, in parallel with the PCB/leg ca ... |
Topic: Timer0 interrupt on pic12f682 |
mkuang
Replies: 4
Views: 11022
|
Forum: General CCS C Discussion Posted: Mon Aug 02, 2010 1:13 pm Subject: Timer0 interrupt on pic12f682 |
You are not using any of the CCS built-in functions. That makes your code very hard to debug without looking at the datasheets. Search this forum on how to write a simple test program using standard C ... |
Topic: 16F873 Interrupts. |
mkuang
Replies: 15
Views: 21257
|
Forum: General CCS C Discussion Posted: Fri Jul 30, 2010 7:03 am Subject: 16F873 Interrupts. |
You do not need this actually:
#BYTE port_b = 0xF81
If you look at the file "18F4520.h" (I don't have that compiler installed on this PC) you should see something like:
#BYTE PORTB ... |
Topic: 16F873 Interrupts. |
mkuang
Replies: 15
Views: 21257
|
Forum: General CCS C Discussion Posted: Fri Jul 30, 2010 6:50 am Subject: 16F873 Interrupts. |
Please post your working program. |
Topic: 16F873 Interrupts. |
mkuang
Replies: 15
Views: 21257
|
Forum: General CCS C Discussion Posted: Fri Jul 30, 2010 6:42 am Subject: 16F873 Interrupts. |
That's not going to work.
You are going to need to change this:
int16 port_b = 0xF81;
to this:
#byte port_b = 0xF81
But why do you need to explicitly declare PORTB. The location is alre ... |
Topic: What will happen "pic programming" in the future? |
mkuang
Replies: 7
Views: 8993
|
Forum: General CCS C Discussion Posted: Wed Jul 28, 2010 11:21 am Subject: What will happen "pic programming" in the future? |
I've never understood the 'make it smaller, no smaller, I mean really, really smaller' push. But that's another story.....
I just did a project whose management decreed I use a TI MSP430. That wa ... |
Topic: A2D channels |
mkuang
Replies: 8
Views: 10524
|
Forum: General CCS C Discussion Posted: Tue Jul 27, 2010 1:40 pm Subject: A2D channels |
Or you can just look at page 3 of the PIC 18F8722 datasheet to see where AN0, AN1, AN2 etc. are. You can't just randomly plug things into different ports and assume it would work. |
Topic: A2D channels |
mkuang
Replies: 8
Views: 10524
|
Forum: General CCS C Discussion Posted: Tue Jul 27, 2010 1:05 pm Subject: A2D channels |
I was using pins A2 (channel 2 - works) and I've tried C5, C4, C3, etc (corresponding to channels 3, 4, 5).
Maybe that is why it doesn't work. According to the 8722 datasheet AN3 is RA3, AN4 is R ... |
|