Author |
Message |
Topic: ADC trouble with the PIC 16F873 |
hanckmann
Replies: 17
Views: 36361
|
Forum: General CCS C Discussion Posted: Fri May 07, 2004 6:14 am Subject: ?????? |
Now I tried to find out what the real problem was. But i still do not have a clue....
This is the code I use now in the while(FOREVER) loop (see the source code listed before). I have enabled the i ... |
Topic: ADC trouble with the PIC 16F873 |
hanckmann
Replies: 17
Views: 36361
|
Forum: General CCS C Discussion Posted: Fri May 07, 2004 5:16 am Subject: OK |
Ok, now I changes some other stuff (I am not yet shure what the problem was) and it DOES WORK !!!
I am now testing what the problem really was. I will add it in this post later.
Thanks for all y ... |
Topic: ADC trouble with the PIC 16F873 |
hanckmann
Replies: 17
Views: 36361
|
Forum: General CCS C Discussion Posted: Fri May 07, 2004 3:45 am Subject: Tried again, nothing changes again... |
Ok, my program compiled succesfully now. It might be a part of my problem, but not everything. It is stil not working. At this moment it only reads a 0 (zero). At least, that is what my program prints ... |
Topic: ADC trouble with the PIC 16F873 |
hanckmann
Replies: 17
Views: 36361
|
Forum: General CCS C Discussion Posted: Fri May 07, 2004 3:04 am Subject: ADFM bit set |
I tried this as well:
ADFM_BIT = 1; // Right justify the A/D result
and this is a copy past from the other post. When I did this the following error occurs:
Error[12] MAIN.C 82 : Undefined ident ... |
Topic: ADC trouble with the PIC 16F873 |
hanckmann
Replies: 17
Views: 36361
|
Forum: General CCS C Discussion Posted: Fri May 07, 2004 2:31 am Subject: Tried but.... |
Ok I tried this:
0x9F= 0x9F | 0x80; // this sets the ADFM bit
but now i get this error message:
Error
#NOLIST // Provided units
#INCLUDE <16F873.h>
#INCLUDE <stdlib.h>
... |
Topic: ADC trouble with the PIC 16F873 |
hanckmann
Replies: 17
Views: 36361
|
Forum: General CCS C Discussion Posted: Thu May 06, 2004 5:48 am Subject: Expecting... |
Well I expect to see a number between 0-1024 corresponding to the voltage which I can measure at the input of the AN0/AN1 to appear at the lcd screen.
The input is now connected to a powersupply (a ... |
Topic: ADC trouble with the PIC 16F873 |
hanckmann
Replies: 17
Views: 36361
|
Forum: General CCS C Discussion Posted: Thu May 06, 2004 5:04 am Subject: Changed, but nothing changes |
Ok, I changed the program following your directions.
The output to the lcd did not change except that the values are now alway 32 or 160.
I don't know if you can do anything with those values, but . ... |
Topic: ADC trouble with the PIC 16F873 |
hanckmann
Replies: 17
Views: 36361
|
Forum: General CCS C Discussion Posted: Thu May 06, 2004 4:39 am Subject: Answers |
1. #DEFINE SETPORTA 0x0B //binary: 001011 RA0
2. I am measuring a DC power. It might change a bit, but at this moment not. (I will think of this for my fnal design)
3. I made an error in the pos ... |
Topic: ADC trouble with the PIC 16F873 |
hanckmann
Replies: 17
Views: 36361
|
Forum: General CCS C Discussion Posted: Thu May 06, 2004 3:28 am Subject: ADC trouble with the PIC 16F873 |
Hello,
I have some trouble reading the ADC. Below I copy-pasted some pieces of the code I use. When I read the ADC I always get the same values (always: 0, 64, 192). I do not understand. I red a lo ... |
|