Using LPT port dot matrix printer with PIC


Results 1 to 8 of 8

Threaded View

  1. #7
    Join Date
    Sep 2004
    Location
    Mentor, Ohio
    Posts
    352


    Did you find this post helpful? Yes | No

    Smile

    Hi sougata,

    Are you interested in the code for a 16F84 serial to parallel converter? If so, here it is:

    (This was on this forum back in January 2004)

    Serial 2 Paraller PRinter Converter
    ________________________________________
    HI! I don't know if this is what you want but give it a try

    THANKS HARRISON PHAM ,for the codding!

    'Serial to Parallel Printer Converter for Generic Printers
    'By: Harrison Pham March 30, 2003
    '---------------------------------------------------
    'PIC: 16F84 at 4mhz
    '
    ' PIC Printer (DB25 Connector)
    ' Pin A1 Pin 16 (Init)
    ' Pin A0 Pin 1 (strobe)
    ' Pin B0 Pin 2
    ' Pin B1 Pin 3
    ' Pin B2 Pin 4
    ' Pin B3 Pin 5
    ' Pin B4 Pin 6
    ' Pin B5 Pin 7
    ' Pin B6 Pin 8
    ' Pin B7 Pin 9
    ' Pin 17 to gnd (Printer Select)
    ' *Pin 14 to gnd (if needed for autofeed feature)*
    ' Pin 18 to gnd (gnd)
    '----------------------------------------------------
    init con A1
    strobe con A0
    char var byte
    trisb = $00 'set portb to all outputs

    high init 'clear init line
    high strobe 'clear the strobe line
    portb = %11111111 'put all data lines high
    pause 1000 'pause for a second

    low init 'init the printer
    pause 500 'pause 500mill seconds to let printer init
    high init 'clear the line

    main:
    serin A2,N9600,[char] 'get characters with serial
    if char = 13 then 'if detected a cr then insert cr and lf
    PortB = 10 'lf
    low strobe 'tell printer to read in byte
    pauseus 200 'wait 200usec for printer to read in byte
    high strobe 'clear the strobe
    PortB = 13 'cr
    low strobe
    pauseus 200
    high strobe
    endif
    portb = char 'set portb to the char byte
    low strobe
    pauseus 200
    high strobe
    goto main


    I'm sorry but I really don't know how to put this into one of those nice little windows. I think I need to find out how to do that. You might want to do a search for this post as there were some people who posted comments about the code.

    HTH!

    BobK

    I use a serial dot matrix printer on one of my projects. I use the DebugOut setup and it works great. I know you're using a parallel but thought I might be able to help!
    Last edited by BobK; - 26th January 2007 at 22:41. Reason: Another idea!

Similar Threads

  1. Pic getting part power from Analog Port
    By ShaneMichael in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 22nd April 2009, 10:34
  2. Change On Interrupt, PIC16F884
    By elec_mech in forum mel PIC BASIC Pro
    Replies: 17
    Last Post: - 14th November 2008, 17:25
  3. Microcontroller with 2 way paging application problem
    By oneohthree in forum mel PIC BASIC Pro
    Replies: 30
    Last Post: - 20th April 2007, 17:27
  4. 8 port Signal Loss Detector, possible to use a pic?
    By jamie_s in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 20th March 2006, 15:59
  5. Serial Pic to Pic using HSER
    By Chadhammer in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 11th March 2005, 23:14

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