Help using 74LS165 & 74LS164 chips with my 16F84A


Closed Thread
Results 1 to 1 of 1
  1. #1
    Join Date
    Jan 2009
    Posts
    14

    Default Help using 74LS165 & 74LS164 chips with my 16F84A

    I bought PIC Microcontroller Project Book for PICBasic and PICBasic Pro.
    Attached is my schematic drawing of what I am working on. The code and schematic come right out of the book on pages 173 fig 12-10 and Source is off page 175 program 12.6.

    Everything works perfect for turning on and off LED's. I have no idea what else I can do with this program. I see a lot of uses I would like to do but and unsure how to apply them.

    Example -
    On one of the input pins on the 74LS165 have a variable POT and read it's value. Then have a servo move according to how far the POT has moved on an output pin on the 74LS164.

    That is something I would like to make happen, but and unsure what would need to be changed in the code to make that happen.

    Any help would be appreciated. Thanks



    CODE:
    Code:
    include "MODEDEFS.BAS"
    
    B0 var byte
    'initialize ports
    TRISB = 4               'set port B pin 2 = input/rest output
    low portb.5             'set CLK low
    high portb.4            'set CLK inhibit high
    high portb.3            'bring shift/load high
    
    start:
    gosub serial_in         'Get number from 74LS165
    serout portb.7, t9600, [$fe,1," ____ ", #B0]
    pause 1000
    gosub serial_out        'send it out on 74LS164
    serout portb.7, t9600, [$fe,1," ____ ", #B0]
    pause 1000              'wait and see what happens
    goto start              'do it again
    
    
    serial_in:
    pulsout portb.3,1       'bring shift/load down momentarily
    low portb.4             'bring clk inhibit low
    B0.7 = portb.2          'load bit into B0
    pulsout portb.5,1       'bring clk pin high, then low
    B0.6 = portb.2          'same as above
    pulsout portb.5,1
    B0.5 = portb.2
    pulsout portb.5,1
    B0.4 = portb.2
    pulsout portb.5,1
    B0.3 = portb.2
    pulsout portb.5,1
    B0.2 = portb.2
    pulsout portb.5,1
    B0.1 = portb.2
    pulsout portb.5,1
    B0.0 = portb.2
    high portb.4            'bring clk inhibit high
    return
    
    serial_out:
    portb.0 = B0.7
    pulsout portb.1,1
    portb.0 = B0.6
    pulsout portb.1,1
    portb.0 = B0.5
    pulsout portb.1,1
    portb.0 = B0.4
    pulsout portb.1,1
    portb.0 = B0.3
    pulsout portb.1,1
    portb.0 = B0.2
    pulsout portb.1,1
    portb.0 = B0.1
    pulsout portb.1,1
    portb.0 = B0.0
    pulsout portb.1,1  
    portb.1 = 0
    return
    Attached Images Attached Images  

Similar Threads

  1. Code works on 16F84A but not on 16F88?
    By pharaohamps in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 6th November 2009, 18:29
  2. Need help for my final project- ISD chips
    By TheCresent in forum General
    Replies: 8
    Last Post: - 11th May 2007, 15:05
  3. ICSP using a 16F84a to program 24CXX
    By aftab in forum mel PIC BASIC
    Replies: 26
    Last Post: - 8th April 2007, 11:39
  4. 4 EEPROM Chips Recording Routine
    By Tom Gonser in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 15th August 2006, 21:11
  5. 16F84A and Optrex LCD
    By coyotegd in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 17th October 2005, 16:08

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