pic 2 pic pic'n my brains out!


Closed Thread
Results 1 to 7 of 7
  1. #1
    Join Date
    Jan 2007
    Location
    Houston, TX
    Posts
    96

    Red face pic 2 pic pic'n my brains out!

    Hello all,
    I have been multiplexing a keypad to my hyperterminal with no problems!
    Now I am trying a more simple program from PIC-2-PIC with no success. I have checked all the basics, ADCON settings, baud rates, modes, qualifier and I am stumped. I have included my code in hopes I made a simple mistake someone with more experience will find.

    'transmitter pic16f628a
    CMCON = 7
    include "modedefs.bas"
    'all other i/o info
    intro:'...all my other stuff
    main:
    while switch = 0
    serout portb.5,n2400,["A",#55] 'I am sending the decimal value 7 to portc of the other pic
    pause 1
    wend
    goto intro
    end


    'reciever pic16f877
    adcon1=7
    include "modedefs.bas"

    'all other i/o info

    main:
    serin porta.0,n2400,["A"],B0 'A is the qualifier , then store a decimal number in B0
    portc=B0' send 7 to port c so I have C.0, C.1, C.2 leds come on
    got main

    thanks,
    Padawan-78

  2. #2
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898

    Default

    is it possible to post the whole codes and OSC speed?

    And post your code in code boxes

    [code]
    paste your code here
    [/code]

    this will looks like
    Code:
           paste your code here
    so your codes stay indented.. more readable.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

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

    Default

    Code:
    serout portb.5,n2400,["A",#55] 'I am sending the decimal value 7 to portc of the other pic
    From the manual
    3) A numeric value preceded by a pound sign ( # ) will send the ASCII representation of its decimal value. For example, if W0 = 123, then #W0 (or #123) will send '1', '2', '3'.
    Dave
    Always wear safety glasses while programming.

  4. #4
    Join Date
    Jan 2007
    Location
    Houston, TX
    Posts
    96

    Default can do

    I have been wondering how to post code in box form for a while...

    Code:
    'transmitter side pic16f628a
    Include "modedefs.bas"   
    Define   OSC 4          
    CMCON = 7                
              
    input PORTB.0
    OUTPUT PORTB.5
    OUTPUT PORTA.0
    SWITCH VAR PORTB.0
    Buzzer VAR PORTB.5
    x VAR BYTE
    
    INTRO:
    for x = 0 to 1
    high buzzer
    pause 50
    low buzzer
    pause 50
    next x
    
    main:
    while switch = 0
            SEROUT PORTB.5,N2400, ["A",#55]
            PAUSE 1
    WEND
    GOTO INTRO
    END
    Code:
    'receiver pic16f877
    INCLUDE "modedefs.bas"
    DEFINE OSC 12
    ADCON1 = 7 'all digital inputs, good to go now!!
    
    input  PORTA.0  'SERIAL INPUT
    Output PORTA.5  'L1
    Output PORTE.0  'L2
    Output PORTE.1  'L3
    Output PORTE.2  'L4
    Output PORTC.0  'L5
    Output PORTC.1  'L6
    Output PORTC.2  'L7
    Output PORTC.3  'L8
    INPUT  PORTD.0  'RX1
    INPUT  PORTD.1  'RX2
    
    Output PORTD.7  'RELAY4	
    Input  PORTD.5  'BACK
    Input  PORTD.4	'NXTSLT
    Input  PORTC.7	'UP
    Input  PORTC.6  'DOWN
    Input  PORTC.5  'RX6
    input  PORTC.4  'RX5
    input  PORTD.3  'RX4
    input  PORTD.2  'RX3
    
    L1		VAR PORTA.5	'8 lights
    L2		VAR PORTE.0
    L3		VAR PORTE.1
    L4		VAR PORTE.2
    L5		VAR PORTC.0
    L6		VAR PORTC.1
    L7		VAR PORTC.2
    L8		VAR PORTC.3
    Relay4	VAR PORTD.7
    tx1 	VAR PORTD.0	'reciever 6 inputs
    tx2 	VAR PORTD.1
    tx3 	VAR PORTD.2
    tx4 	VAR PORTD.3
    tx5 	VAR PORTC.4
    tx6 	VAR PORTC.5
    back	VAR PORTD.5
    nxtslt	VAR PORTD.4
    up		VAR PORTC.7
    down	VAR PORTC.6
    B0      VAR byte
      
    low l1:low l2:low l3:low l4:low l5:low l8: low relay4
    
    start:
    LCDOut 254,1
    Pause 1000
    High L1
    Pause 90
    Low L1
    High L2
    Pause 90
    Low L2
    High L3
    Pause 90
    Low L3
    High L4
    Pause 90
    Low L4
    High L5
    Pause 90
    Low L5
    High L6
    Pause 90
    Low L6
    High L7
    Pause 90
    Low L7
    High L8
    Pause 90
    Low L8
    HIGH Relay4
    PAUSE 90
    LOW RELAY4
    
    main:
    SERIN PORTA.0,N2400, ["A"],B0
    'PAUSE 1
    PORTC = B0
    GOTO MAIN
    As this is only a test, I just want to see something on my pcb to show that I have good serial data coming in (leds on portc) then I will move on to LCD text input output from pic16f628a multiplexed keypad...
    thanks for the help with the text boxes!
    Padawan-78

  5. #5
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898

    Default

    So your serial data is on the same pin as your Buzzer?

    Did you set HS_OSC fuse for your F877?

    Your PIC16F628 use the internal OSC? Sure the Config fuses are set for it?

    As Dave suggested, you want to make sure your qualifiers match on Both Side. Two way here.. or you change #55 to 55 in your SEROUT line, or you change B0 to #B0 in your SERIN line.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  6. #6
    Join Date
    Jan 2007
    Location
    Houston, TX
    Posts
    96

    Default oops

    Looks like my reply did not come through,
    yep I made some dumb mistakes....including, forgetting to set clock to HS on the 877, setting the correct output for my serial data on the 628a, and the way my data was sent #...thanks alot for the help

    I am wondering...can you send serin/serout without using a qualifier?
    Padawan-78

  7. #7
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898

    Default

    Yes you can!
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

Similar Threads

  1. Presetting Configuration Fuses (PIC Defines) into your Program
    By Melanie in forum FAQ - Frequently Asked Questions
    Replies: 82
    Last Post: - 15th December 2013, 09:54
  2. PIC 2 PIC wireless connection
    By MegaADY in forum General
    Replies: 1
    Last Post: - 24th June 2004, 01:46
  3. how to connect 2 LCDs on a PIC
    By f1fco in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 15th April 2004, 17:59
  4. Pic to Pic communication?
    By Rob Martin in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 11th April 2004, 19:41
  5. Serin2/Serout2 PIC 2 PIC
    By actionplus in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 22nd March 2004, 06:46

Members who have read this thread : 1

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