Variable to Pinout conversion


Closed Thread
Results 1 to 7 of 7
  1. #1
    Join Date
    Jul 2004
    Location
    CA
    Posts
    78

    Default Variable to Pinout conversion

    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

  2. #2
    Join Date
    Feb 2004
    Location
    Germany
    Posts
    762


    Did you find this post helpful? Yes | No

    Default

    Srig,

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

    your "gu-estimation" is correct
    regards

    Ralph

    _______________________________________________
    There are only 10 types of people:
    Those who understand binary, and those who don't ...
    _______________________________________________



  3. #3
    Join Date
    Jul 2004
    Location
    CA
    Posts
    78


    Did you find this post helpful? Yes | No

    Default thanks

    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

  4. #4
    Join Date
    Jul 2004
    Location
    CA
    Posts
    78


    Did you find this post helpful? Yes | No

    Default need help

    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
    Attached Files Attached Files
    Last edited by Srigopal007; - 14th April 2005 at 17:22.

  5. #5
    Join Date
    Mar 2003
    Location
    Commerce Michigan USA
    Posts
    1,166


    Did you find this post helpful? Yes | No

    Default

    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

  6. #6
    Join Date
    Jul 2004
    Location
    CA
    Posts
    78


    Did you find this post helpful? Yes | No

    Default

    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

  7. #7
    Join Date
    Jul 2003
    Location
    Sweden
    Posts
    237


    Did you find this post helpful? Yes | No

    Question

    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

Similar Threads

  1. EEPROM Variables (EE_Vars.pbp)
    By Darrel Taylor in forum Code Examples
    Replies: 79
    Last Post: - 26th October 2012, 00:06
  2. Variable PWM PIC18F2431
    By trr1985 in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 12th June 2009, 06:03
  3. Help with sound command in 2 programs
    By hyperboarder in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 5th July 2007, 20:36
  4. WORD vs BYTE variable lengths
    By bartman in forum General
    Replies: 0
    Last Post: - 28th November 2005, 21:16
  5. 16bit variable and degrees conversion
    By RFsolution in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 2nd May 2005, 17:27

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts