Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   Scanning of multiple inputs (http://www.go4expert.com/forums/scanning-multiple-inputs-t20956/)

calvinlyp 11Feb2010 19:03

Scanning of multiple inputs
 
Hi all, i am relatively new to C programming, so pardon my ignorance.

i am trying to program a micro controller which uses c language.

i require to read from multiple inputs, and simultaneously display or print out for the user to see, may i know how should i go about doing it?

eg.
i have a,b and c inputs.
each coming from a different source but arrive at the same time, but how do i display these 3 values concurrently, which this 3 values should display as a group.

any advice will be greatly appreciated.

xpi0t0s 12Feb2010 15:29

Re: Scanning of multiple inputs
 
Which compiler are you using?
Which microcontroller (specify exactly, e.g. Microchip PIC16F887)?
What hardware is it connected to? Post a circuit diagram.
What are the nature of the inputs; are they analog or digital, and what form does the input take: is it a continuously varying signal, a stream of 1's and 0's, etc?
What are the outputs; are they LEDs, some kind of display (what exactly)? What exactly do you want the outputs to do in relation to the inputs: if LEDs and binary inputs, do the LEDs just display the inputs 1=on, 0=off? You mentioned printing - are you connected to a printer in the sense that an HP Laserjet is a printer, or do you mean something different by "print"?

If you're completely new to microcontrollers then the best advice is to follow a tutorial to get you started. Try this for starters:
http://www.winpicprog.co.uk/pic_tutorial.htm
Or you could invest in one of the MikroElektronika boards; I just got myself an EasyPIC6.

calvinlyp 12Feb2010 23:43

Re: Scanning of multiple inputs
 
as my reply was too long i attached it as a .txt file.

thanks for any reply.

i am relatively new to Psoc development pardon my ignorance.
i am currently working on integrating accelerometer with the development kit.

i found an article on
http://www.cypress.com/?docID=19786

after consulting an expert, he noted to me that the application note i had referred is for connecting an Accelerometer to PSoC1 devices which have SAR and ADCINC incremental ADCs. PSoC3 does not have a SAR8 user module. Instead i can use the ideas proposed in the application note but substitute the ADC with the Deltasigma ADC from PSoC.

i am purchasing a similar accelerometer(http://sgbotic.com/index.php?t...ts&product_id=440) to integrate on the PSoC development board.

1)since now the accelerometer i am using is 3axis should i follow the concept of the article, by using a mux? or sholud i use 3 individual ADC to read from each x,y and z?
as the x,y,z value from the accelerometer will be available for the ADC to read at the same time.

this lead to next question
2) if i was to use a mUX,there is two mux available in the creator software, i was thinking of using the AMUXSeq, as i need to differential x,y and z value.
is this a better choice out of the two?

3) since PSoC development board had its own LCD, from the article, i can remove the concept of I2C to display on the external device right?
however can the LCD display simultaneously 3 values by writing at the appropriate position of the LCD(ie i send to print string of x,y and z value at different position of the LCD)?
as the LCD is only one port, can it take in 3 functions to write at the same time?

or should i set the values of x,y,z in some buffer and display at one time?

thanks

shabbir 13Feb2010 09:38

Re: Scanning of multiple inputs
 
Moved attachment into post.

xpi0t0s 13Feb2010 19:17

Re: Scanning of multiple inputs
 
Well you know more about Psoc than me. I've only been using PICs so far.

1. depends on the project requirements. An ADC takes an amount of time to perform the conversion so the question is how frequently do you need to take readings? Can you get the required bandwidth out of just one ADC? If not then you will need three ADCs.

Another consideration is: Can you spare three pins for three ADCs? If you can't then that settles the question for you.

On the other hand what is easier? Does it make programming easier or harder to use three ADCs or to multiplex three inputs into one ADC?

2. No idea. But this question may be rendered moot by the answers to 1.

3. Yes. Unless the psoc has 3 CPUs on board you won't be doing anything simultaneously; you will read from one ADC, then the next, then the 3rd. When you display stuff on screen just display all three values in different places.

If psoc has a multitasking OS and you're just writing a thread to read one ADC and display it on screen, and having 3 of those threads, then you'll have to serialise LCD access (i.e synchronise your threads so they don't try to write to it at the same time) otherwise you will confuse it. Also if you MUX the ADCs you'll have to serialise that as well, so it may just be easier to do the whole lot in one thread. You wouldn't be looking at a vast amount of code anyway.


All times are GMT +5.5. The time now is 19:27.