Question on IO ports


Results 1 to 5 of 5

Threaded View

  1. #1
    Join Date
    Jan 2009
    Posts
    14

    Default Question on IO ports

    I received the book "PIC Microcontroller Project Book for PICBasic and PICBasic Pro Compilers"

    The book uses the 16F84A PIC in most of it's examples. In chapter 12 it shows an example using the 16F84A along with a 74LS164 to add 8 more IO ports incase you ever need more ports and the PIC you are using does not have enough.

    Question -
    Below is the sample source code along with my schematic drawing. This works great for turning on and off the LED's but I want to know what I need to do in order to send text to my 2x16 LCD using one of these ports.

    Would appreciate some help please.
    Thanks

    Code:
    include "MODEDEFS.BAS"
    
    lcd1 var porta.0
    led1 var porta.1
    led2 var portb.2
    
    B0 var byte
    TRISB.0 = 0
    
    pause 1000
                       
    main
    
    high led1
    pause 100
    low led1
    pause 100
    high led2
    pause 100
    low led2
    pause 100
    
    B0 = 128
    gosub serial
    pause 1000
    B0 = 64
    gosub serial
    pause 1000
    B0 = 32
    gosub serial
    pause 1000
    B0 = 16
    gosub serial
    pause 1000
    B0 = 8
    gosub serial
    pause 1000
    B0 = 4
    gosub serial
    pause 1000
    B0 = 2
    gosub serial
    pause 1000
    B0 = 1
    gosub serial
    pause 1000
    B0 = 255
    gosub serial
    pause 1000
    B0 = 0
    gosub serial
    pause 1000
    
    goto main
    
    serial:
    portb.0 = B0.7
    pulsout 1,1
    portb.0 = B0.6
    pulsout 1,1
    portb.0 = B0.5
    pulsout 1,1
    portb.0 = B0.4
    pulsout 1,1
    portb.0 = B0.3
    pulsout 1,1
    portb.0 = B0.2
    pulsout 1,1
    portb.0 = B0.1
    pulsout 1,1
    portb.0 = B0.0
    pulsout 1,1
    portb.1 = 0
    return
    Attached Images Attached Images  
    Last edited by studysession; - 16th February 2009 at 01:37.

Similar Threads

  1. Simple question regarding ports
    By rngd in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 22nd February 2008, 16:37
  2. Replies: 1
    Last Post: - 29th September 2007, 18:05
  3. SHIFT command QUestion
    By k2nneth in forum General
    Replies: 0
    Last Post: - 14th March 2007, 16:32
  4. Please answer my first question
    By John_001 in forum Off Topic
    Replies: 1
    Last Post: - 15th September 2006, 06:49
  5. 16f872. config ports and serin question.
    By kitcat in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 20th July 2005, 03:03

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