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.
Hello, I need some assitance for my project here. I want to know how to program to read a digital signal with a PIC 16F84A. Then, after read it I have to store it in some register. Can anyone help me solving this problem?, because I am a beginner user and very....very need help.
What exactly do you wanna read? One pin, low or high level? A changing-with-time-digital-signal? A whole byte? The storage part of the process looks easy. If it is a number (suposse you've got it now in PORTB) you only have to move it to the work register and place it wherever you want:
PORTB equ 0x06 ; You're giving a familiar name to mem position h'6'
NUMBER equ 0x0C ; You're saying this mem position is called "number"
movf PORTB,0 ; You're moving your value to the work register (that "0" indicates it, if "1" you will be moving it to PORTB= no move at all, but useful sometimes)
movwf NUMBER ; You're taking a copy of your value from the work register to mem position h'C'=d'12'=NUMBER
Now, if your number is bigger than a byte size= more than 8 (bits) pins, you'll have to cut it to store it. Imagine you've received this number b'0101111010' (a ten bits number) you'll get a part in PORTB and a part in PORTA (cause PORTB has only 8 pins assigned to it) so you´ll have to connect your wires to get, for example, the lowest bits in PORTB and the highest in PORTA. Your ports could be like this:
porta= 00000001
portb= 01111010
See? You should save it also in two registers which you could name, for example:
NUMHIGH equ 0x0C
NUMLOW equ 0x0D
This was in order to get a single number (with 8 or more bits). In comparison with this, getting a sole bit would be very easy. But, in comparison with this getting a digital signal at real time would be very hard.
first of all, thanks for the reply Skyknight . The reading is using one pin (ra1) (I don't know about low or high level.....can you tell me what is it?......I am a beginer..... ). The signal is changing-with-time-digital-signal I guess.... and I have to read and store 25 bits digital signal. I have written a program that similar with your idea.....but still, it doesn't work..... . So, do you have any more idea about this?.....
:? I'm not still sure about what do you want to read. 25 bit!? Please, tell me where are you getting your signal from. If you are using just one pin, then I think you want to read one signal that could be like this: (see the attachment) And you are waitng the information will last long only 25 pulses. Note the wave in the drawing can be codified like this (starting from the left): 101101001011. If it is that case, I have no experience on getting info in that way. But, all I know, is that you should use another PIC equiped with the MSSP module (Master Synchronous Serial Port) like 16F876 (28 pin). Maybe if your source of binary information has not a very high clock frecuency you could be able to explore your RA1 pin quickly enough to store the value and come back to explore the pin again. But that seems quite difficult to me, because you wouldn't be using the same clock signal for your source and for your PIC.
I am getting the signal from a transmitter. The signal look alike your attachment Skyknight (using one bit). Unfortunately, my project has to use PIC16F84A. Thanks anyway.
Well, which is the frec of transmition? If it's a KHz frec maybe you will be able to detect a change on the clock pulse and have a reaction on time. :?
(Oh! I'll ask some albert-einstein-friends of mine)
The freq is 433 kHz. Oh, maybe it'll be better if I attach my schematic diagram and one of my example input signal. As you can see the signal is received by the RF module first and then goes to ra1. Actually I have eight transmitters which transmit eight different signals. I have to identify which signal is coming, and then turn on one LED lamp (there are 8 LED's). one signal type for one LED. Thanks again......
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.