PDA

View Full Version : Pic16f84a Question ?



amenoera
- 11th March 2008, 06:26
Hi All .

I Have A Litle Problem Here , And Am Sure I Will Find The Answer Here . The Problem Is :
Am Using Picbasic Pro Compiler .
I Need To Read Portb Value . And Then Send It Serially To Another Pic .

The Problem Is When I Connect My Pic16f84a It Send The Value Continuously Without Stop . And I Dont Need That I Need When I Make Pin 0 High Then Send "1" And When I Make Pin 7 High Send "128"
Etc . .
So What Can I Do For That ?

Thanks .

Jerson
- 11th March 2008, 08:13
Here's a little pseudo code for you

OldValue var byte

repeat
if oldvalue <> PortB then
oldvalue = PortB
SendInteger PortB
endif
forever

Sendinteger is a function to send the numeric value of PortB as a string.

With the above code, you will send only when there is a change from the previous value.

Good Luck

amenoera
- 11th March 2008, 22:45
and what about pic basic ?

i neverd used pseudo befor .

thanks

Jerson
- 12th March 2008, 05:31
Pseudo code shows the logic. You have to implement it in PicBasic or any language you choose.