CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

plz help me (define the character from adc reading)

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Guest








plz help me (define the character from adc reading)
PostPosted: Tue Apr 03, 2007 4:43 am     Reply with quote

hi

i have problem in writing the code

i need to write a code that read reading from 3 sensors (2 pressure sensors and 1 water sensor)

from these 3 sensors, the signals will receive by one transmitter before entering pic.

when entering pic, it will converted to digital form (using built-in adc converter) and comparing the with certain values for the next action

before this i write reading the value sequentially from the sensors.(I mean from sensor 1, then sensor 2, then sensor 3; by some delay) but to implement this i must put timer on the transmitting circuits to on and off the transmitter sequentially.but my supervisor reject this way.

he ask me to write a program that read all the sensor at the same time and after converting the signal to digital form, to differentiate the readings, i must able to differentiate it character by character. i need to separate the reading because different sensor has different minimum values.

i don't know to do this. can anybody help me.

this is what i done previously.
Code:


void main() {

  int i, value[3];

  setup_port_a( ALL_ANALOG );
  setup_adc( ADC_CLOCK_INTERNAL );
  set_adc_channel( 0 );

   
    for(i=0;i<=3;i++)  {
   
    delay_ms(5000);
   
   
    *value = read_adc();}
jecottrell



Joined: 16 Jan 2005
Posts: 559
Location: Tucson, AZ

View user's profile Send private message

PostPosted: Tue Apr 03, 2007 8:20 am     Reply with quote

I assume your supervisor has a problem with the 'delay_ms(5000)' between each reading? And you only read AN0. Are you saying that you have all three sensors muxed into AN0?

While you can't get a simultaneous AD reading on three channels, you can get them fairly quickly. The datasheet will show you how to calculate the acquisition times... usually tens of microseconds each, or so.

More info about your hardware would help, more info about your code would help, and PIC part number and speed is also good to provide....

John
Guest








PostPosted: Tue Apr 03, 2007 10:32 am     Reply with quote

jecottrell wrote:
I assume your supervisor has a problem with the 'delay_ms(5000)' between each reading? And you only read AN0. Are you saying that you have all three sensors muxed into AN0?

While you can't get a simultaneous AD reading on three channels, you can get them fairly quickly. The datasheet will show you how to calculate the acquisition times... usually tens of microseconds each, or so.

More info about your hardware would help, more info about your code would help, and PIC part number and speed is also good to provide....

John


thank you for the reply...

actually my project is to read pressure from 2 tires (front and hind tires) and oil level sensor....

to receive the signal, my PIC16F876 is connected to ONE receiver only...so as i said earlier, i want to ON and OFF the receiver sequentially so that the signal can be received one by one. is it wrong application?is it wrong to muxed all the signal to AN0 only? or you might have any idea?

can you give idea on how if i want to receive all the signals at the same time and how to differentiate the character frames? i need to use the reading for comparison. did I need to separate analog channel?

for your info, i use this pre-set functions for this transmission:

#use delay(clock=20000000)
#use rs232(baud=9600, rcv=PIN_C3, bits=7)


sorry I am quite new in programming the PIC..therefore I am not fully understand in this pic programming. i hope anybody can help me....[/code]
jecottrell



Joined: 16 Jan 2005
Posts: 559
Location: Tucson, AZ

View user's profile Send private message

PostPosted: Tue Apr 03, 2007 11:01 am     Reply with quote

Sorry,

Can't help much without a clear and accurate description of what your hardware configuration is. Until you take the time to describe in detail what parts you are using, how they are connected, etc. No one is going to be able to help you.

John
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group