• 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.

Urgent! PIC16F84A Help needed

Status
Not open for further replies.

SocMatt

New Member
Hello,

I know that this is extremely cheeky, but I desperately need assistance. I need someone to write, or help me write a program to produce what is outlined in this message's attachment. I have very little time to produce this circuit and have absolutely NO knowledge of PIC microcontrollers whatsoever! I have tried finding the relevent information on the internet but to no avail.

Anyone who can help me will be greatly appreciated.

Thanks

Matt
 

Attachments

this looks real simple. make a delay loop for .5s each half second set output 1 and output 2 to what you want. then make a continuious loop. So, set 1 high 2 high, wait .5s set 2 low, wait .5s set 2 high and 1 low wait .5s....etc. till you map poy 10s of you waveform..then loop back and do it over again
 

TheAnimus

New Member
SocMatt if you've still got a need for this code been made, if you give me a few more details about the project (ie any code it has to work with, if so what interface etc) i might be able to nock somthing up!
 

SocMatt

New Member
Hello

Basically, all that is necessary is for the PIC to produce the two repeating waveforms continously. It is not necessary for any specific pins to be used of anything like that. The waveforms will simply be used to drive the input of an oxygen sensor and so needn't sink/source any current at all really.

There are no other microcontrollers, etc, in the circuit so that should make the program simple, but I am so busy that I don't have time to familiarise myself with the programming language.

Cheers

Matt
 

sbayeta

New Member
I don't have the time for writing the program myself, but I can give you some hints to write it quickly:

You can divide both your waveforms in 20 parts of 1/2 second each, and asign each output its correspondig value. The secuence of values would be:

Code:
out1: 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
out2: 1 0 1 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0
Create a list in RAM of 20 registers containing this values. You will be using only the first two bits.

Use some PIC with Timer1 module (such as 16F87x), and use a Real Time Clock (see Microchip's application notes AN580 and AN582). This way you'll have an interrupt every one second, with a precission given by a 32KHz crystal (usually 20ppm).

In the interrupt vector (org 0x04) make a counter from 0 to 19. This counter will help you navigate the list. Using this pointer, make a computed goto to the corresponding entry in the list to recover the values. Move the values to the PORTB and voila.

Hope that gets you started

cheers
 

ivancho

New Member
I had a little time so here its what I came up with:
Code:
'Oxigen Sensor
'By: Ivan Quiroz
'PIC16F84
DEFINE OSC 4

X VAR BYTE


TRISB = %00000000
PORTB = %00000000	'Bit0 = Output1   Bit1=Output2

Loop:

PORTB = %00000011   'Output 1 and 2 HIGH  
Pause 500			'Waits 0.5sec
PORTB = %00000001   '
Pause 500			'Waits 0.5sec
PORTB = %00000010   '

Pause 500
Low PORTB.1

For X=1 TO 2
	Pause 500
	High PORTB.1
	Pause 500
	Low PORTB.1
Next X

Pause 6500

GoTo Loop
Attached is the HEX file ready to program a PIC16F84 @ 4Mhz
 

Attachments

SocMatt

New Member
Cheers for your help but it didn't seem to work. I may have a problem with the practical circuit. Have you any suggestions of any circuit diagrams.

Cheers

Matt
 

ivancho

New Member
How did you connect the PIC and which PIC are you using? Here is a schematic of what the circuit should look like:
 

Attachments

Status
Not open for further replies.

Latest threads

EE World Online Articles

Loading
Top