Author |
Message |
Topic: How to insert int into unsigned long? |
pgaastra
Replies: 6
Views: 11578
|
Forum: General CCS C Discussion Posted: Sun Feb 17, 2008 4:21 pm Subject: How to insert int into unsigned long? |
Thanks once again PCM Programmer.
I see I need to read up on macros too! |
Topic: How to insert int into unsigned long? |
pgaastra
Replies: 6
Views: 11578
|
Forum: General CCS C Discussion Posted: Sun Feb 17, 2008 1:06 pm Subject: How to insert int into unsigned long? |
Thanks PCM programmer
Use the make16() function. It's built-in to the CCS compiler.
I am using an ancient compiler v2.731. I'll have to upgrade some time.
I'll see how I go with Robert Scot's adv ... |
Topic: How to insert int into unsigned long? |
pgaastra
Replies: 6
Views: 11578
|
Forum: General CCS C Discussion Posted: Sun Feb 17, 2008 1:00 pm Subject: How to insert int into unsigned long? |
Thanks Robert,
doing the <<8 certainly does get optimised. |
Topic: How to insert int into unsigned long? |
pgaastra
Replies: 6
Views: 11578
|
Forum: General CCS C Discussion Posted: Thu Feb 14, 2008 7:44 pm Subject: How to insert int into unsigned long? |
Sorry for the simple question but I'm trying to insert a hi byte into an unsigned long without multiplying by 256 or left shifting 8 times.
I had the following code:
byte* BytePointer;
... |
Topic: A/D conversion spurious readings |
pgaastra
Replies: 9
Views: 9251
|
Forum: General CCS C Discussion Posted: Mon Nov 05, 2007 6:08 pm Subject: A/D conversion spurious readings |
Amazing!
I already had the linear regulator on the PCB (being supplied by the lab supply).
My circuit diagram said I had a 10uF cap after the regulator but looking at the PCB I think it was 1uF ... |
Topic: A/D conversion spurious readings |
pgaastra
Replies: 9
Views: 9251
|
Forum: General CCS C Discussion Posted: Mon Nov 05, 2007 4:35 pm Subject: A/D conversion spurious readings |
I have joined AN0 to Vss with just about the shortest piece of wire possible and cut the track that was going to that pin and the readings still have more jitter than I would like eg 0,0,0,2,0,0,0,0,0 ... |
Topic: A/D conversion spurious readings |
pgaastra
Replies: 9
Views: 9251
|
Forum: General CCS C Discussion Posted: Mon Nov 05, 2007 3:56 pm Subject: A/D conversion spurious readings |
I tried it on an identical PCB (except for a different regulator chip) and the readings range from 0 to 8 so thats a lot better than 0 to 18.
Nevertheless I was under the impression that 10 bits ... |
Topic: A/D conversion spurious readings |
pgaastra
Replies: 9
Views: 9251
|
Forum: General CCS C Discussion Posted: Mon Nov 05, 2007 2:23 pm Subject: A/D conversion spurious readings |
Thanks PCM Programmer.
I tried your program (not that there was anything really different) and I get the same spurious readings.
That points to bad PCB design or faulty chip. I find it very har ... |
Topic: A/D conversion spurious readings |
pgaastra
Replies: 9
Views: 9251
|
Forum: General CCS C Discussion Posted: Mon Nov 05, 2007 1:06 pm Subject: A/D conversion spurious readings |
Thanks PCM Programmer, you wrote:
Quote:
enable_interrupts(GLOBAL);
Get rid of this line. You have no interrupt service routine.
Sorry, the program was a simplification of another p ... |
Topic: A/D conversion spurious readings |
pgaastra
Replies: 9
Views: 9251
|
Forum: General CCS C Discussion Posted: Sun Nov 04, 2007 7:58 pm Subject: A/D conversion spurious readings |
Hi, I have a simple A/D conversion program written in pcm V2.731 (an oldie but a goodie)
I am just reading channel 1 and printing the result out the serial port.
With vref+ = VDD and Vref- = Vss
... |
Topic: write_eeprom() causing reset. |
pgaastra
Replies: 6
Views: 10983
|
Forum: General CCS C Discussion Posted: Wed Jan 19, 2005 8:01 pm Subject: write_eeprom() causing reset. |
I found the problem. Somehow that write_eeprom must not have deal with the interupt control register properly. I just added:
disable_interrupts(global) after my write_eeprom and no more resets.
... |
Topic: write_eeprom() causing reset. |
pgaastra
Replies: 6
Views: 10983
|
Forum: General CCS C Discussion Posted: Tue Jan 18, 2005 4:04 pm Subject: write_eeprom() causing reset. |
Code that doesn't work has stack height of 4.
I've been diverted from this job for a while. I'll try to narrow down the problem to see what's wrong before wasting any more of everyone's time.
... |
Topic: write_eeprom() causing reset. |
pgaastra
Replies: 6
Views: 10983
|
Forum: General CCS C Discussion Posted: Tue Jan 18, 2005 12:56 pm Subject: write_eeprom() causing reset. |
Thanks for that reply PCM Programmer.
I had a look at the thread you pointed out. I am not using interrupts. I am using timer 0.
I am using CCS PCM version 2.731. It does save the INTCON and ... |
Topic: write_eeprom() causing reset. |
pgaastra
Replies: 6
Views: 10983
|
Forum: General CCS C Discussion Posted: Mon Jan 17, 2005 7:59 pm Subject: write_eeprom() causing reset. |
I have a PIC16LF84 running on a 3V battery and a 32.768kHz crystal
I have written some code which writes to 8 places in eeprom using the CCS pic c compiler write_eeprom() function. I have no watc ... |
Topic: getchar() hanging. |
pgaastra
Replies: 6
Views: 13135
|
Forum: General CCS C Discussion Posted: Sun Oct 31, 2004 4:04 pm Subject: getchar() hanging. |
I said I changed the baud rate to 110 from 300 and it now works.
I had a look at the machine code produced by the compiler for each baud rate, for getchar() and it's identical. How can that be? I ... |
|