Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Weather Vane

Status
Not open for further replies.
Cheers, everyone..

I am currently reviewing ericgibbs comments (That will take time)

After reading Mikebits if I think Correct.... By passing the output voltage of the windspeed through a discrete ADC It will then turn the analogue input into a digital binary signal that can simply but read by the porgram at the input port

eg. binarynumber$=Inp(&H378) 'variable is equal to the binary input at parallel port
Then binarynumber$ would = 10110 for example which equates the input voltage of 5 volts say.... If the input voltage changes then the binary number is different....

(Im learning this as I go along so if i've made a mistake then can someone please correct me)
Cheers everyone,

Owen.

Hi Owen,
The port address 378h is configured by the Win operating system as a Output,
you will need to use the Control register to change to an Input.

When you do read the 378h port it will be hex value, in your example [10110] it would be 16h
[ BTW I would recommend when you write a Binary value use all 8 bit places,, 00010110. [ 22 decimal].

Does this help.?:)
 
Last edited:
Cheers I just realised that..... woops..

even in qbasic would the input figure be a hex value? or would the output from the ADC be binary?

Cheers...

Owen
 
Cheers I just realised that..... woops..

even in qbasic would the input figure be a hex value? or would the output from the ADC be binary?

Cheers...

Owen

hi,
Binary is the bit representation of a hex value.

Most likely if you use an external 8 bit ADC ic, the output would be 8 bits wide, which would represent a hex value.

This 8 bit Byte would be read by the port, the program would see it as a hex value and you then convert to decimal for displaying.

Ok.?
 
Last edited:
So I have to write a program that converts HEX to decimal....

thought of a problem the parallel port has D0 - D7 which are the data lines.... If I had an 8 bit ADC, then that leaves no room for any other sensors....

Or is my thinking once again flawed!

Cheers,

Owen.
 
Take a look at this paper for some ideas on expanding your I/O.
https://www.electro-tech-online.com/custompdfs/2008/11/12.pdf

Considering your experience level, perhaps you might consider only using a single sensor to start with, and move up to more sensors as your experience grows...
Just a thought.
 
Last edited:
So I have to write a program that converts HEX to decimal....

thought of a problem the parallel port has D0 - D7 which are the data lines.... If I had an 8 bit ADC, then that leaves no room for any other sensors....

Or is my thinking once again flawed!

Cheers,

Owen.

hi,
The package I posted only uses 4 port pins and it gives you 4 adc inputs.
What you do with the remaining pins is your choice.

Which other 'sensors' do you have in mind.?

What ever you do with an adc input you will need to convert from hex to decimal [ASCII].
This conversion when using VB can been achieved with a couple of lines of code.
 
Last edited:
hi,
The package I posted only uses 4 port pins and it gives you 4 adc inputs.
What you do with the remaining pins is your choice.

Which other 'sensors' do you have in mind.?

What ever you do with an adc input you will need to convert from hex to decimal [ASCII].
This conversion when using VB can been achieved with a couple of lines of code.

That ADC looks ideal, can use it for all sensors, and use remaining 4 bits to address decode.

Won't Qbasic work with hex variables? Why the need to convert to dec?
 
That ADC looks ideal, can use it for all sensors, and use remaining 4 bits to address decode.

Won't Qbasic work with hex variables? Why the need to convert to dec?

hi Mike,:)

The need to convert is so us poor mortals can read it more easily, especially if there are decimal places involved.

For reference, there is a MCP3208, a 8 adc channel version of that ic.

I use the 2 and 4 channel, with additional OPA's to 'span' the voltages.

Using a LM35 tempr sensor + OPA, the adc's give a tempr display.

example image attached.

Keep well!
 

Attachments

  • esp03 Nov. 10.gif
    esp03 Nov. 10.gif
    15.5 KB · Views: 147
hi,
The package I posted only uses 4 port pins and it gives you 4 adc inputs.
What you do with the remaining pins is your choice.

Which other 'sensors' do you have in mind.?

What ever you do with an adc input you will need to convert from hex to decimal [ASCII].
This conversion when using VB can been achieved with a couple of lines of code.


sensors I had in mind were the

windvane (so i could find the direction of wind)
anemometer (so i could measure wind speed)
a thermistor
and a humidity sensor

as far as I am aware these are all analouge signals that would all need the use of an ADC.

The major point is that I put that i am creating (created by the time it would be read) a weather station on my UCAS form (at my tutors instruction) and I've now sent it off so im stuck with making it because it would look really bad saying that at a uni interview.....

cheers,

Owen

PS. where do you get the MCP3204 from? assuming that is the name of the chip.... would a product like this be similiar, the 12bit at the bottom: **broken link removed**
 
Last edited:
using this chip which is capable of four inputs, I can connect these four inputs to the ADC. But how does chip defien between the different outputs or do I have to basically create four delays to feed the data in individually?

Cheers everyone, I will be talking to my teacher tomorrow to get a better idea of this, He will be teaching us about ADC's later this school year but we are starting our coursework soon..

Cheers,

Owen.
 
Last edited:
Ignore this post. I made a boo boo...:)
My image did not post right. See next post.
 
Last edited:
The ADC chip Eric suggested uses a serial interface. So you select ADC input channels by sending data to the chip serially. Your software has to output clock, data, and chip select. Kinda like in image below. In the data stream you tell the chip the channel you want to select.
Note: The image below is Microwire but is similar to SPI as used on the MCP part.

So on your Pport you would have something like so;

D0--->Clock
D1--->Data
D2--->Chipselect/
SO you would Outp data bit on D1
then outp Chipselect low on D2
then in software toggle clock low to high to low on D0. I would suggest making a clock routine to save on code writing. See diagram.
You might want to google SPI to learn more about it.
 

Attachments

  • serialiface.jpg
    serialiface.jpg
    30.9 KB · Views: 134
Last edited:
using this chip which is capable of four inputs, I can connect these four inputs to the ADC.
But how does chip defien between the different outputs or do I have to basically create four delays to feed the data in individually?
Owen.

hi,
You asked for examples in VB on how read the parallel port, [using external adc ic's] have you taken the time to read thru the fully working program and interface drawings I posted 2 days ago, its ALL in there if you look.?:)
 
Last edited:
Your right Eric, I have been confused, as he first said Qbasic, then vbasic. And by the questions it seems he has not read any of your offered material.
 
Your right Eric, I have been confused, as he first said Qbasic, then vbasic. And by the questions it seems he has not read any of your offered material.

Morning Mike,
I thought it was just me, possibly missing something.:)

For the past few days we seem to have a number of threads running, where the OP isnt taking a blind bit of notice of the posted help and and advice he has requested!

I think some of them are just looking for reassurance of what they are doing wrong is right.

I'll be OK when the caffeine kicks in.;)
 
Last edited:
hi,
You asked for examples in VB on how read the parallel port, [using external adc ic's] have you taken the time to read thru the fully working program and interface drawings I posted 2 days ago, its ALL in there if you look.?:)

It is true that i haven't really read your earlier post, the main reason was I didn't understand it, it confused me and I was already very confused as it was. The reason I asked for VB was because most people on this board that I have seen seem to have a lot of knowledge in VB... Now I dont understand VB (I know someone in my class that does) and I thought if someone could tell me VB I could then get it roughly translated into component parts and then do the same with Qbasic (They are both variants of the same core language so I thought they cant be far off)

I'm really trying to get my head round this.. and as you can tell failing VERY badly,

I've never used ADC's before, I've only started learning Qbasic within the last 2 months, I do however have a habit of pushing on through and getting the end result. The major thing is.. I have nothing to play with, therefore I cant create things and tinker till I get it right...

some of the responses have been great, but still a little too complicated for me.

anyway now thats over.....

From what I understand (ericgibbs' s post 2 days ago with the pictures is now starting to make sense) I need 4 cables going to the parallel port (D0, D1, D2, D3), one of the is the clock so some from of oscillator (crystal for example) the other line is data which comes out of the ADC, the other one is the selector which i guess you Output from the pc to the ADC with a signal that switches the selector switch over....

again thank you for your comments I do take time to read them but sometimes they are a little too over my head therefore I end up asking questions as my knowledge increases that end up have being answered 2 - 3 days ago.

Owen
 
Last edited:
I'm really trying to get my head round this.. and as you can tell failing VERY badly,

I've never used ADC's before, I've only started learning Qbasic within the last 2 months, I do however have a habit of pushing on through and getting the end result. The major thing is.. I have nothing to play with, therefore I cant create things and tinker till I get it right...

some of the responses have been great, but still a little too complicated for me.

anyway now thats over.....

From what I understand (ericgibbs' s post 2 days ago with the pictures is now starting to make sense) I need 3 cables going to the parallel port, one of the is the clock so some from of oscillator (crystal for example) the other line is data which comes out of the ADC, the other one is the selector which i guess you Output from the pc to the ADC with a signal that switches the selector switch over....

again thank you for your comments I do take time to read them but sometimes they are a little too over my head therefore I end up asking questions as my knowledge increases that end up have being answered 2 - 3 days ago.

Owen

Hi Owen,
The important point is that you are trying to get to grips with the technology.:D

To use the PC parallel port [ for whatever purpose] you will need a 25Way 'D' type mating 25 pin plug connector.

Looking at the drawing there are 4 signal wires , clock, data in, data out and chip select ,also a 0V common wire. The wires should ideally be screened overall, no more than a metre long.

All the signals for the MCP3204 are generated by the VB program and the 4 wires carry the signals to and from the MCP.
In order to have 'strong' enough signal levels a 74LS07 buffer ic is required in these 4 wires.
So these are the basic bits you need for any connection to the port.

The VB5 program shows how to drive these 4 signal wires in order to read the MCP 4 adc channels.

Look thru it some more and get back to us.
 
Last edited:
Hello Ericgibbs,

Cheers for your reply... It may be just me but in the .zip package you sent me i cant find source code, i can open the .exe (all values set to 4.99 which is because i've got nothing connected to the parallel port). I do not have VB installed on my pc ...

I've also spent time really reviewing the .pdf and it makes sense with the Op-Amps to amplify everything

Is there anyway we could move this away from VB5 and perhaps back to QBasic because I thought it would make it easier for everyone..

Its made it easier for you which is great - but unfortunatly looking at the complexity of the system I've realised that it is no longer easier for me....
I've already tracked down a functioning HEX to decimal converter which I understand and can easily tweek...

I'm starting to understand things a little clearer now.. We've done a lot of things to do with outputing in Qbasic including building a DAC, and a light box to light LED's to each of the control lines and data lines (Strobe, init, D0 - D7 etc) However, We have not covered inputing data (Other than the need for buffers)


Thankyou (sorry for being a pain)

Owen.
 
Hello Ericgibbs,

Cheers for your reply... It may be just me but in the .zip package you sent me i cant find source code, i can open the .exe (all values set to 4.99 which is because i've got nothing connected to the parallel port). I do not have VB installed on my pc ...

I've also spent time really reviewing the .pdf and it makes sense with the Op-Amps to amplify everything

Is there anyway we could move this away from VB5 and perhaps back to QBasic because I thought it would make it easier for everyone..

Its made it easier for you which is great - but unfortunatly looking at the complexity of the system I've realised that it is no longer easier for me....
I've already tracked down a functioning HEX to decimal converter which I understand and can easily tweek...

I'm starting to understand things a little clearer now.. We've done a lot of things to do with outputing in Qbasic including building a DAC, and a light box to light LED's to each of the control lines and data lines (Strobe, init, D0 - D7 etc) However, We have not covered inputing data (Other than the need for buffers)


Thankyou (sorry for being a pain)

Owen.
hi,
I have just download and unzip the zipped file, its all there, it runs OK.
The *.frm is the text/source.
To run it, if you had VB5, double click the *.vbp file

You can get a free version of Visual Basic from microsoft.

You will have to give me a couple of days for the QBasic conversion,.:)

Just to be sure, when you say QBasic is that Quick Basic or QBasic?

With no external ic's on the port you will read 4.99V!.
 
Last edited:
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top