PDA

View Full Version : Variable to Pinout conversion



Srigopal007
- 12th April 2005, 23:14
For anyone who is knowledgible about picbasicprr, I would like to ask a simple question. I am a little uncertain about my syntax from my code. here is what I have done and I presume that it is correct.

Hello var byte
TRISD = %00000000

start:
Hello = 47

PortD = Hello

''''''''''''''''''''''''''''''''''''''''''''
When I write PortD = Hello. is this the same thing as writing
PortD.0 = 1
PortD.1 = 1
PortD.2 = 1
PortD.3 = 1
PortD.4 = 0
PortD.5 = 1
PortD.6 = 0
PortD.7 = 0

Please let me know if what I just said makes any sense and if the output will be what I gue-stimated.


Srig

NavMicroSystems
- 12th April 2005, 23:34
Srig,

if codespace and execution time etc. doesn't matter:

your "gu-estimation" is correct

Srigopal007
- 12th April 2005, 23:43
Well, this is exactly what I thought was the answer to my own question and now that someone has clarified my thinking a little more. This is exactly what I have been trying out for the past two plus days and have gone nowhere on the project. Will post the design with some code. hopefully someone can help find the issue. stay tuned. and thanks for the reply.


srig

Srigopal007
- 14th April 2005, 17:16
I have been working and trying to get this 5x7 display
going for the past week but have not made it work. I
know that my programming is correct, at least I
assume it is. But since my outputs are not correct
it;s makingme think twice if my program is actually
working.

here is what I am trying to do. I first sent out the
address from portD(to determine what digit slot the
characters need to be placed), then I set the pin on
PortC.2 = 0 so that the address can be latched into
74LS373. Now that the address is latched, I can sent
the data out from the same port, without it
interefering with the address bits that has already
been latched into the 74LS373. Once the data bits
gets sent to the 74LS245 it then sends the bits
directly to the Display device. The display device
does not output the characters until the output of the
OR_GATE is LOW.
I have attached a schematic to show you exactly how my
hardware is interfacing with all these chips The
Orgate chip that I am using is 74LS32.

And here is the link to the Display device I am trying
to output characters to (click on the floppy disk icon
on the right side next to the DLX1414.

http://katalog.elektroda.net/indx0-DL.html


Any help with this would be greatly appreciated.
thanks


here is what I have done in my code.

'notice that it is the last two bits in the address
'variable that determines what digit slot the
'character will display.

Address VAR Byte
D_Data VAR Byte
i var byte
WR_SIGNAL VAR PortE.1
ALE_SIGNAL VAR PortC.2

Start:

Address = 47 'binary equiv 00101111
GoSub Address_Latching
D_Data = 32 'decoded to display a blank
GoSub Send_Data

Address = 46 'binary equiv 00101110
GoSub Address_Latching
D_Data = 32 'decoded to display a blank
GoSub Send_Data

Address = 45 'binary equiv 00101101
GoSub Address_Latching
D_Data = 32 'decoded to display a blank
GoSub Send_Data

Address = 44 'binary equiv 00101100
GoSub Address_Latching
D_Data = 32 'decoded to display a blank
GoSub Send_Data

Pause 1500


Address = 47 'binary equiv 00101111
GoSub Address_Latching
D_Data = 1 'Decoded to display an up arrow
GoSub Send_Data

Address = 46 'binary equiv 00101111
GoSub Address_Latching
D_Data = 2 'decoded to print a right pointing arrow
GoSub Send_Data

Address = 45 'binary equiv 00101111
GoSub Address_Latching
D_Data = 3 'decoded to print a down pointing arrow
GoSub Send_Data

Address = 44 'binary equiv 00101111
GoSub Address_Latching
D_Data = 4 'decoded to display a left poiinting arrow
GoSub Send_Data

Pause 1500
Goto Start


Address_Latching:
ALE_SIGNAL = 1
PortD.0 = Address.0
PortD.1 = Address.1
PortD.2 = Address.2
PortD.3 = Address.3
PortD.4 = Address.4
PortD.5 = Address.5
PortD.6 = Address.6
PortD.7 = Address.7
ALE_SIGNAL = 0
Pauseus 500
ALE_SIGNAL = 1

return

Send_Data:
WR_SIGNAL = 1
PortD.0 = D_Data.0
PortD.1 = D_Data.1
PortD.2 = D_Data.2
PortD.3 = D_Data.3
PortD.4 = D_Data.4
PortD.5 = D_Data.5
PortD.6 = D_Data.6
PortD.7 = D_Data.7
WR_SIGNAL = 0
Pauseus 500
WR_SIGNAL = 1

return

Dave
- 14th April 2005, 17:33
Srigopal007, Why are you writing each bit to the port individually? You can just write all bits in the byte in one operation by using:

Address_Latching:
ALE_SIGNAL = 1
PortD = Address
ALE_SIGNAL = 0
Pauseus 500
ALE_SIGNAL = 1

return

Send_Data:
WR_SIGNAL = 1
PortD = D_Data
WR_SIGNAL = 0
Pauseus 500
WR_SIGNAL = 1

return

Just figured you could save some lines of code.....

Dave Purola,
N8NTA

Srigopal007
- 14th April 2005, 17:40
hi, thanks for the reply, but code space is the least of my worries. the main this is making sure that the portD is set up correctly before the ALE! and WR! signals are made LOW. At least that is what I think my problem might be


srig

Ingvar
- 15th April 2005, 10:14
Hi Srig,

Why bother with all the 74's atall? You could connect the 10 pins you're using directly to the display, saves money, space and work.

/Ingvar