Why (or how to) make a port array for OW


Results 1 to 9 of 9

Threaded View

  1. #1
    Join Date
    Feb 2009
    Location
    Stockholm / Moscow
    Posts
    6

    Default Why (or how to) make a port array for OW

    Hi all !
    This is my first post but this forum has been my extended manual or knowledge base for a couple of years.

    I'v tried to do a array and a for next loop to addres a port(pin) where I have a DS18B20 on each pin.

    Why I want a loop is to not need multiple lines of reads and calculations but a repeated read with changed port adressing.

    I dont get it working with port(pin) arrays UNLESS I do a Tris first and since i do that i direct the port to be either output or input but for OWin an OWout there will be bidirectional communications.

    Pbp 2.50 EasyPic 2 and 5 Microcode studio 3.0.0.5
    Pic F877A
    porta 0-7 all DS18b20.
    Portc is leds for monitoring the states of port.
    The supplied code is NOT working unless i un-rem the Tris statement.
    The loop counter is working on the LCD.
    This is just a test code for adressing problem.

    adcon1=7 ' digital port on port A

    portnr var word[8]


    Deg CON 223 ' Data to display Deg ° symbol
    CLR CON 1 ' CLR LCD command
    LINE1 CON 128 ' LCD line #1
    LINE2 CON 192 ' LCD line #2
    LINE3 CON 148 ' LCD line #3
    LINE4 CON 212 ' LCD line #4
    INS CON 254 ' LCD command mode parameter
    Sign VAR BYTE ' +/- sign for temp display
    Dummy VAR BYTE ' Dummy for Div32

    'Portc = %00000000 'Initiate all port c pins to low
    'Trisc = %00000000 'Setup port c as all outputs


    start:

    lcdout ins,clr
    lcdout INS,LINE1, " ++ Startup ++ "
    Pause 500

    for portnr = 0 to 7
    pause 200
    lcdout INS,LINE2, dec portnr
    portc.0[portnr] = 1
    pause 200
    next portnr

    pause 1000
    goto start



    Brgds Roy
    Last edited by Roy___; - 21st February 2009 at 21:23. Reason: Versions of everything...

Similar Threads

  1. Simple Array Demo
    By Archangel in forum Code Examples
    Replies: 5
    Last Post: - 15th February 2010, 04:46
  2. Change On Interrupt, PIC16F884
    By elec_mech in forum mel PIC BASIC Pro
    Replies: 17
    Last Post: - 14th November 2008, 17:25
  3. array and port
    By piombazzo in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 9th November 2008, 20:58
  4. Microcontroller with 2 way paging application problem
    By oneohthree in forum mel PIC BASIC Pro
    Replies: 30
    Last Post: - 20th April 2007, 17:27
  5. pins in arrays?
    By scorpion in forum mel PIC BASIC Pro
    Replies: 16
    Last Post: - 17th September 2005, 08:18

Members who have read this thread : 0

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