PDA

View Full Version : Need help in program for remote control using PIC16F84A



Madscientist
- 16th July 2006, 00:25
Hello all,

I am new to PIC programming and am using a PIC16F84A. I would like to program it to make one of the pins go "high" when, and only when the input pins accept a certain binary code and in a particular order. Example:

Pin 6 is low, pin 7 is high, pin 8 is low and pin 9 is low. That would be the binary code "0100" or simply the binary code for the number "4"

The next inputs would be:
Pin 6 is high, pin 7 is low, pin 8 is low and pin 9 is high. That would be the binary code "1001" or simply the binary code for the number "9"

And finally:
Pin 6 is low, pin 7 is low, pin 8 is high and pin 9 is low. That would be the binary code "0010" or simply the binary code for the number "2"

After that sequence has been completed, I want to have the output of another pin go "high"

The binary codes that are inputed into the PIC are generated from the output of a DTMF decoder. In other words, I want to press "492" on a touch tone keypad and have it activate a project. Basically I want to control a project remotely from a telephone.

Any help on the source code would be appreciated. Like I said, I am very new to programming but enjoy designing electronic circuits.

Darren

mister_e
- 16th July 2006, 02:25
help us a little bit and provide your DTMF decoder chip model.

Madscientist
- 16th July 2006, 04:39
I use the 8870 chip. It is an 18 pin DIP. Its input is DTMF from a phone or receiving radio. The output is a binary code ( four pins ). The only place I have seen this decoder is at BG micro.com out of Texas. I have used several of them and they always work perfect. I want to run the four output pins of the 8870 to four inputs on the PIC MCU 16F84a. The 8870 DTMF decoder holds the output constant until a new tone is entered in. In other words, if I touch the number 3 key on a touch tone phone, the output on the 8870 would be "0011" until I touched another key.

Furthermore, I am using an epic programmer from ME lab and the PicBasic compiler (if that helps). And let me remind you, I'm an idiot when it comes to programming these things. I'm just getting started. Thanks for the reply. Any help would be appreciated.

Darren

mister_e
- 16th July 2006, 09:43
Sounds simple to me. Any schematic could be handy to start.

Madscientist
- 16th July 2006, 19:17
I put together a schematic of the project I am designing. Sorry that it is a little "scrunched" but I assume you don't have the software that I am using to design it. It was difficult to get the entire schematic on the screen at one time. I designed it on Livewire by New Wave Concepts. I converted the image to a JPEG photo and am sending it as an attachment for your ease of viewing. Thanks again for your input. ( let's see if I am actually successful in attaching the photo, hahahaha)

Darren

mister_e
- 16th July 2006, 20:23
the most inefficient way but easy to follow.


LOW PORTB.4
Key var byte

start:
Key=(PORTB&$0F) rev 4
If Key<>4 then Start
While key
Key=PORTB&$0F
wend
pause 50

Wait2nd:
Key=(PORTB&$0F) rev 4
if key=0 then Wait2nd
If Key<>9 then Start
While key
Key=PORTB&$0F
wend
pause 50

Wait3rd:
Key=(PORTB&$0F) rev 4
if key=0 then Wait3rd
If Key<>2 then Start

HIGH PORTB.4
Spin:
goto spin

Madscientist
- 16th July 2006, 22:09
Steve,

Thanks a million for the code. I tried it in my complier but had problems. I think it was because your code was designed for Pic Basic Pro and I only have the standard version. I found that out because I saw you used the statement "wend" which I believe is only supported by the Pro version compiler. I am attaching two JPEG photos of what the errors screen looked like when I tried to compile it. The first photo is what your code looked like in my compiler starting at line 11 and ending on line 38. The second photo was what the error messages looked like. I will try to make some changes but unfortunately I don't understand much about the Pic basic language yet. Thanks again.

Darren

Madscientist
- 25th July 2006, 15:11
Woooo Hoooooo !!! I finally got it. Only took me about one and a half pages of code to do this simple task. You got me going in the right direction Steve, Thanks

Darren