My serial to parallel attempt


Closed Thread
Results 1 to 5 of 5
  1. #1
    Join Date
    Dec 2012
    Posts
    4

    Smile My serial to parallel attempt

    I have tried to re-write a serial to parallel program found in John Iovine's "PIC Microcontroller Book", in the chapter on serial communication.His program was written in PIC basic, but I wanted to re-write and compile in PICbasic Pro. Nevertheless, even when my program compiled successfully, it did not perform successfully on the circuit board. I used a pic16F84A, a 74LS164 serial-in, parallel-out shift register, a 32.768 Khz crystal, 8 LEDs and 8 330 ohm resistors. I have not inserted the code or schematic as yet but will upload these later. The objective was to send info serially to the 74LS164, which in turn would output the 8 bit number in parallel to 8 LEDs.

  2. #2
    Join Date
    Dec 2012
    Posts
    4


    Did you find this post helpful? Yes | No

    Default Re: My serial to parallel attempt

    A brief look at my circuit can be found at this link.


    My code for this project is below, if loaded successfullly.

    ' serial out interface
    'slow program for visual testing interface
    'initialize ports

    TRISB = 0 'set portb as output port
    b0 var byte
    pin0 var byte
    start:
    b0 = 128 'put number 128 ( 1000 0000) into b0
    Gosub serial 'output the No. serially to 74ls164
    'pause 1000 'wait 1 sec
    b0 = 255 'Put No 255 (1111 1111) into b0
    Gosub serial 'output the No. serially to 74ls164
    'Pause 1000 'wait 1 sec
    b0 = 0 'Put No. 0 (0000 0000) into b0
    Gosub serial 'output the No. serially to 74LS164
    'Pause 1000 'wait 1 sec
    Goto start 'do it again

    'serial out routine

    serial:
    pin0 = portb.7 'bring pin 0 high or low depending
    'upon bits
    Pulsout 1,1 'Bring CLK line high, then low
    'pause 100 'same as above
    pin0 = portb.6 'same as above
    Pulsout 1,1 'same
    'Pause 100 'same
    pin0 = portb.5
    Pulsout 1,1
    'pause 100 'optional delay
    pin0 = portb.4
    Pulsout 1,1
    'pause 100
    pin0 = portb.3
    Pulsout 1,1
    'pause 100
    pin0 = portb.2
    Pulsout 1,1
    'pause 100
    pin0 = portb.1
    Pulsout 1,1
    'pause 100
    pin0 = portb.0
    Pulsout 1,1
    'Pause 100
    Low 1
    Return

  3. #3
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default Re: My serial to parallel attempt

    Look at the SHIFTOUT command in the PBP manual. It does the hard work for you.
    Dave
    Always wear safety glasses while programming.

  4. #4
    Join Date
    Dec 2012
    Posts
    4


    Did you find this post helpful? Yes | No

    Default Re: My serial to parallel attempt

    Thanks for the direction and tip. I have found out a bit more about about sending and receiving serial information using the PIC. Such commands as serout, hserout and even shiftout. My test was to try synchronous data, and to use a clock. It seems that I could even do away with the 74LS164 and use another PIC chip to receive. That is, a 12F683 could read in some analog voltage, send it out serially and be intercepted by a 16F84, 16F628 or 16F684 and sent out to a 2 or 3 digit 7-segment LED. It may also be an easier task to use the built-in asynchronous serial transfer. I will also be looking at this alternative.
    Last edited by johndoug; - 4th January 2013 at 04:18.

  5. #5
    Join Date
    Dec 2012
    Posts
    4


    Did you find this post helpful? Yes | No

    Default Re: My serial to parallel attempt

    Thanks. I will look at it the first opportunity I get. My circuit is synchronous transfer, but I will also look at the advantages of asynchronous using other pic commands like serout and serin. I want to further explore these with the 16F84A, 16F628 and 16F684.
    Last edited by johndoug; - 4th January 2013 at 04:18.

Similar Threads

  1. Parallel LCD to Serial LCD
    By Mostafa in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 17th June 2007, 21:14
  2. serial in parallel out using PIC
    By daxki in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 5th April 2007, 01:06
  3. Serial to parallel converter using shiftin
    By daxki in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 3rd April 2007, 15:05
  4. parallel LCD to serial LCD
    By maxbao in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 28th October 2006, 11:44
  5. First attempt at coding
    By bartman in forum mel PIC BASIC
    Replies: 0
    Last Post: - 10th November 2004, 17:52

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