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.
As far as I'm aware (with the help wikipedia!) Qbasic is different to QuickBasic although Qbasic is built on Quickbasic, and I am attempting to use Qbasic..

It seems odd that nothing = 4.99V although I suppose its all got to do with the type of chip on the motherboard and how they react.....

Cheers,

Owen.


PS. just downloaded VB
 
As far as I'm aware (with the help wikipedia!) Qbasic is different to QuickBasic although Qbasic is built on Quickbasic, and I am attempting to use Qbasic..

It seems odd that nothing = 4.99V although I suppose its all got to do with the type of chip on the motherboard and how they react.....

Cheers,

Owen.
PS. just downloaded VB

The 4.99V is because the port pull up resistors hold the pin high, so the program reads all '1's which is 1111,1111,1111[FFFh] [4095] which the programs thinks is 4.99V.

I have just downloaded QBasic onto to my spare PC, it runs all my older QB4.5 programs OK... so keep your fingers crossed.

Start learning VB...:D
 
Last edited:
I spose that does make sense all those 1's....

VB express takes a long time to install still going....

Cheers,

Owen
 
Hello again, I have talked to my teacherabout ADC's, he knows a lot about the ACD ic's that you can get but he also showed me an example of an ADC which is made up of a DAC, a comaprator, and an analouge signal...

basiclly from his explaination, he said the analouge signal goes into the comparator, along with the output from the DAC, the computer at the input of the DAC cylcles the pins 0 - 255 very quickly, when the output of the DAC and the analouge signal are the same then the output of the comparator is in theory 0 (I know it in practice can't get to 0 but near as damnit) which then sends a signal to the acknowledge pin of the PC which tells the PC that what ever number causes the acknowlege signal is the digital equivilant of the the analouge input signal..

Would I be right in thinking that the IC ADC's are not far off, if so then i know how an ADC works...... But not the code behind it (woops!)

Cheers,

Owen
 
hi Owen,

Are you saying you want to change the ADC ic type.?

If Yes, post a full circuit diagram of the project.
 
Hello Ericgibbs,

No i'm not, i was just saying how i think im starting to understand ADC's, the principle of how they work etc... etc..

I've had a thought about this 12 bit ADC, dose that mean throught the serial connection it sends 12 bits of data on the clock pulses each one needing to be indidually read, and then combined into one variable..

If so then I have learnt something!!

Cheers,

Owen
 
Hello Ericgibbs,

No i'm not, i was just saying how i think im starting to understand ADC's, the principle of how they work etc... etc..

I've had a thought about this 12 bit ADC, dose that mean throught the serial connection it sends 12 bits of data on the clock pulses each one needing to be indidually read, and then combined into one variable..

If so then I have learnt something!!

Cheers,

Owen

Yes you essentially have it correct. Refer to the timing diagram I posted earlier.
 
Thanks for your reply Mike,

After reviewing your previouse post, looking a SPI on wikipeidia, I makes little sense. However, I am determined to get this working and will battle through.

I have been assured by my teacher (Many a time!) that the programming is not marked he says I should concentrate on the electronics.. However, I feel that I need a basis to work from to develop my system and the programming is as I feel this major basis.. I mean I can make all the sensors, i can make an AM transmitter and receiver fine, (After ericgibbs's posts on the MCP chip, and a lot of help from everyone) I can now wire up An ADC .. it wont be a walk in the park... I need the ability to interface the ADC with Qbasic, and I can work from there and we are off.

Thank you,

Owen
 
hi Owen,
My PC's are running WinXP Pro, I normally use a couple of DLL's to get access to the parallel port when using VB5..no problems.

However when using QB4.5 or QBasic I cannot access the port, which I expected would be the case.
Looked at some software options on how to get access to the port, but basically it would mean loading Win98 on a free partion on my hard drive or using a virtual DOS program.

I dont want to install Win98 on my working PC's, so I have problem in that I cannot at this time help out with QBasic..:(

Somewhere in the loft I do have an old MMX200 PC with Win98SE installed, if you get completely stuck I could dig that out,,,, yuk!

I would suggest you learn Visual Basic.

EDIT:

Have modified on old PC to run on Win98SE. Installed Qbasic.

If you have written the QBasic program, post it and I will give a try with my MCP3204 hardware.
 
Last edited:
Cheers,

thanks anyways,

I've installed VB but dont understand the code you sent me, would it be so much to ask that you break down in processes what the code needs to archeive, eg does the clock pulse come from inside the IC, to the PC or vice versa....

Cheers,

Owen
 
Cheers,

thanks anyways,

I've installed VB but dont understand the code you sent me, would it be so much to ask that you break down in processes what the code needs to archeive, eg does the clock pulse come from inside the IC, to the PC or vice versa....

Cheers,

Owen

hi Owen,
This a copy of the function description I posted previously.
:)
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.

Send me a PM.:)
 
For detecting the rotation of your weather vane. An opto-interruptor may give you better results if accuracy is important. A mouse with a rubber ball has two of them.

The opto-interruptor is made of two devices a transmiting LED and a Phototransistor.
infrared I think. In side the mouse the spoked wheel causes the Phototransistor to turn on and off when the spokes of the wheel interupt the beam between the LED and the Transistor. ( ISBN 0-07-141358-8 ) section 8 - experiment 46

Liberty Basic INP: You can down load Liberty Basic free and it runs on an XP. Examples:
if INP(889) <> 127 then do SOMETHING
if INP(890) = 63 then do SOMETHING maybe you can use this info
 
Last edited:
Cheers, everyone for your comments,

DALEE, is the output of the phototransistors, I never thought of them...they would work, I could put the signal straight into the parallel connector then... Would Qbasic respond in the same way as LibertyBasic, I have dosbox to run Qbasic but i dont think it can access the ports..

EricGibbs, I noticed in your signature PIC tutorials (Im guessing your not to bad with PICS) could it be possible to use the ADC pins on the PIC 18 -24 to then ouptut a PARALLEL signal to the paralell port to then just read the whole port... casue that means there is no need for clock pulses or anything then also in the Qbasic code you could run a selectro cable and in the PIC say:

If pins = %00000001 then gosub adc_1
if pins = %00000011 then gosub adc_2
etc..

to run different ADC tasks....

Its a thought casue you would still need the buffers into and out of the PC, and the amplifiers as well...


Your thoughts are most helpful,

Owen
 
Last edited:
hi Own,
You could use an intermediate PIC, but that would be 'wasteful'.
It would be necessary to program the PIC to read the MCP analog inputs using the parallel port, which would still require a program.

If you wanted to use a PIC, look at the 18F1320 version, it has a number of analog input ports and serial UART built in.

The method would be to use the PIC' s UART [RS232] to connect to the PC's serial port, the PC would do the datalogging and display.

Let me know what YOU decide and I/we will try to guide thru it. OK.?

BTW: I have a PC running QBasic under WIN98SE,,, its make your mind up time.:)
 
Last edited:
Cheers,

I'm sorry if i never expalined it well, the Qbaisc will end up working as data logger to then display on the screen...

I thought the PIC has 4 onboard ADC converters which would give you an number porportional to the voltage, and then if I new the memory locations of the data I could output it in a parallel fashion. The thing on my mind is serial connections sends the data 1 bit at a time, thoes bits then have to be arranged in Qbasic, now is that as simple as:

Inp(&H378); sensors$

or what ever the input port is I can only remember H378.. no in this case would the all the serial data be stored into that sensors$ variable Or just the single BIT that was at the port at that time.

When you respond to this I will amke up my mind as to the direction I think this could be taken...

Thank you,

Owen
 
Cheers,

I'm sorry if i never expalined it well, the Qbaisc will end up working as data logger to then display on the screen...

I thought the PIC has 4 onboard ADC converters which would give you an number porportional to the voltage, and then if I new the memory locations of the data I could output it in a parallel fashion. The thing on my mind is serial connections sends the data 1 bit at a time, thoes bits then have to be arranged in Qbasic, now is that as simple as:

Inp(&H378); sensors$

or what ever the input port is I can only remember H378.. no in this case would the all the serial data be stored into that sensors$ variable Or just the single BIT that was at the port at that time.

When you respond to this I will amke up my mind as to the direction I think this could be taken...

Thank you,

Owen

hi,

The Inp(&H378); sensors$ in your program would only read the PORT as 'hex', it still would need to be 'processed' by additional programming to make it usable for logging and display.
In QBasic the following code fragment is for one of the four channels and repeated using a different CmdStr in order to read all 4 channels.

'
Code:
channel0
Out Po378, ElDhCh
'send  data bits to ADC0 msb 1st
For p = 1 To 24
    If Mid$(CmdStr0, p, 1) = "1" Then
    Out Po378, ElDhCh
    Out Po378, ElDhCl
    Out Po378, ElDhCh
    Else ' lo
    Out Po378, ElDlCh
    Out Po378, ElDlCl
    Out Po378, ElDlCh
    End If

'read each bit and evaluate the weighting, load the array with sum
'if bit is '1' then get Ary value else skip
    V = Inp(Pi379) And Dinp
        If V <> Dinp Then
        ADCValue0 = ADCValue0 + Ary(p)
        End If
Next p
Out Po378, EhDhCh 'idle

'divide by 12 bit [4096] and change to a voltage
'change the '5' to suit your parameter scaling
    Volt0 = (ADCValue0 / 4096) * 5
    AvgV0 = AvgV0 + Volt0

As I said, you choose from the options available, I dont mind.:)
 
So I would need to repeat that 4 times? and that stores a voltage in AvgV0...

That would work alongside the MCP3204 with the signal lines discussed earlier....


I would like to go with tha option as you appear to be very, very knowledgeable..

I am intrested by the ElDhCh part of the code,

Cheers,

Owen
 
So I would need to repeat that 4 times? and that stores a voltage in AvgV0...

That would work alongside the MCP3204 with the signal lines discussed earlier....

I would like to go with tha option as you appear to be very, very knowledgeable..

I am intrested by the ElDhCh part of the code,

Cheers,

Owen
hi,
That VB code is in that zip file.

The El Dh Ch represent, E-nable line Low, D-ata Line High, C-hip Select High.
They have been defined earlier in the code.

I would suggest you build the interface shown in the pdf drawing.

You will need that to to debug/run any program you write.

The *.exe in that zip will drive the interface shown in the drawing.
 
Is it possible to replicate that code using Qbaisc ..

set the variables El Dh Ch, change the output port etc..

V = Inp(Pi379) And Dinp
If V <> Dinp Then
ADCValue0 = ADCValue0 + Ary(p)
may I ask what dinp is? as well as Pi379?

cheers,

Owen
 
Is it possible to replicate that code using Qbaisc ..

set the variables El Dh Ch, change the output port etc..

V = Inp(Pi379) And Dinp
If V <> Dinp Then
ADCValue0 = ADCValue0 + Ary(p)
may I ask what dinp is? as well as Pi379?

cheers,

Owen

hi,
The back conversion of the code from VB to QBasic is not difficult, I have already done it.
Over the weekend I am going use my MCP3204 interface on a Win98 PC..

The Pi379, is the Parallel port address 379[ hex] and the 'i' is to indicate input.

'dinp' is the 'data' byte that is read by the program from the port
 
Last edited:
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top