How to configure the ports in RISC microcontroller?

Status
Not open for further replies.

darkxp

Newbie level 4
Joined
Mar 23, 2004
Messages
7
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
66
port digital

Hi there... here i am again!

Well, the problem now are different, first i want to read a 0/1 in a RA1, for example, but only when RA0 = 1, how to configure the ports, and how to receive the data? can i store the data in a Var? (its for a magnetic card reader project in my university...)

thnx in advance.

i try to find info on digital ports reception, but not well explained, and our teachers are selfish... LOL well, thnx
 

Re: port digital

Well, I'll try to help you altough i'm just a beginner in a risc microcontroller.
Before i answer, I want to know what is the configuration of RA1, as input or output. If it's configured as output (to control something) then it's simple, just add an AND Gate that will be used to enable the input to RA0.

RA1-----|----\
| |-------RA0
In ------|----/

Then reset The TrisA for RA1 -> output
And set the TrisA for RA0 -> input.

I hope my answer is right due to your problem.[/img]
 

Re: port digital

Im new too.... (5days only... LOL)

Ok, the analog is for input, to read a track of 0s and 1s, in a short space of time, like 1seg... i think this must be done in analog port...


.)
 

Re: port digital

If I understand correctly, you are trying to read a serial stream of data (weigand?) from a card reader. What you need to do is use an interrupt on this port if possible, you do not say what the MCU is. Most languages have also a command like "get" or similar that will sit and wait for an input. If you are using a serial port it will be stored in the input buffer, you will then need to convert it to a form that is of use to you.

May I suggest that you do a bit of reading on the web, then come back with more specific questions.

Or did I misunderstand, and you only want to detect a high on the pin. In this case tie it low with a resistor 4k7?. and use an IF statement in a loop to check when it goes high, easy lol

BTW, it is usually better to pull high and check for low input.
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…