12f675 serial pic2pic


Closed Thread
Results 1 to 5 of 5
  1. #1
    tagan's Avatar
    tagan Guest

    Default 12f675 serial pic2pic

    I am trying send serial data pic 12f675 to 16f8777 and show this value on the lcd panel but it doesn't work. here is the program code. any ideas pls.
    12f675:
    INCLUDE "MODEDEFS.BAS"
    @ DEVICE INTRC_OSC, WDT_OFF, MCLR_OFF, PWRT_ON
    define osc_4
    DEG VAR BYTE
    CMCON=7
    ANSEL=0
    TRISIO.0=0
    DEG=1
    BASLA:
    PAUSE 3000
    SEROUT2 GPIO.0,16780,["A",DEG]
    PAUSE 200
    END
    16f877:
    INCLUDE "MODEDEFS.BAS"
    define osc_4
    DEFINE LCD_DREG PORTB
    DEFINE LCD_DBIT 4
    DEFINE LCD_EREG PORTB
    DEFINE LCD_EBIT 3
    DEFINE LCD_RWREG PORTB
    DEFINE LCD_RWBIT 2
    DEFINE LCD_RSREG PORTB
    DEFINE LCD_RSBIT 1
    DEFINE LCD_BITS 4
    DEFINE LCD_LINES 2
    DEG VAR BYTE
    ADCON1=7
    TRISB=0
    TRISC=1
    LOW PORTB.2
    PAUSE 100
    LCDOUT $FE,1
    PAUSE 100
    BASLA:
    SERIN2 PORTC.0,16780,[WAIT("A"),DEG]
    PAUSE 200
    LCDOUT $FE,2,#DEG
    end

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


    Did you find this post helpful? Yes | No

    Default

    could be many things here. But at least, can you confirm all of the following tests
    1. Is a simple led blink work on both of your PIC
    2. Is the LCD work on your 16F877

    Another thing... is the SERIN Idle state may cause you a grief? idle what? look at the following post...
    http://www.picbasic.co.uk/forum/show...86&postcount=5

    Be sure you set the transmitter pin to the corect state before sending something.

    You DEFINE OSC is not correctly writen.. no problem anyway, it will not be considered. Chances are that the default OSC is 4. DEFINE spelling and writing is often discussed here... almost every week/month. They must be written as state in the manual, in UPPERCASE.
    DEFINE OSC 4 without any underscore.

    Also, when using 12Fs with internal osc in a serial comm, you should consider using the OSCCAL value to ensure a better Oscillator precision. Personnally i always use it, serial comm or not. it's just a simple code line after all

    SET OSCCAL_1K 1

    If you have a good device programmer, and if you're lucky, the OSCAL value is still there. To check it, just read your PIC and look at the last memory location... should different of 3fff

    what else... maybe enough to start i guess

    what about ...
    Code:
    ' 12F675
    @ DEVICE INTRC_OSC, WDT_OFF, MCLR_OFF, PWRT_ON 
    DEFINE OSCCAL_1K 1
    DEG VAR BYTE
    CMCON=7
    ANSEL=0
    TRISIO.0=0
    GPIO.0=0    ' Set corect idle state
    DEG=1
    
    BASLA:
        PAUSE 3000
        SEROUT2 GPIO.0,16780,["A",DEG]
        PAUSE 200
        goto BASLA
    You don't need to attach the R/W pin of your LCD to the PIC if you don't plan to read from. Just connect it to GND.
    Last edited by mister_e; - 12th March 2006 at 22:37.
    Steve

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

  3. #3
    Join Date
    Mar 2003
    Location
    Commerce Michigan USA
    Posts
    1,166


    Did you find this post helpful? Yes | No

    Default

    tagan, How long are you waiting after poweron for the 16f877 before you powerup the 12f675? I notice that you only send the data once and end the program execution. Maybe you are not waiting long enough for the LCD display to initialize before sending the data to it. I would place a delay before the data is sent to the LCD display and make sure the 16F877 is ready to receive the data before you send it.

    Dave Purola,
    N8NTA

  4. #4
    tagan's Avatar
    tagan Guest


    Did you find this post helpful? Yes | No

    Default

    thanks for your warning. I solve this problem change the mode 16789 to 396. yes you are right. it isnt necessarry to use portb.2 if I only write on the lcd . but it isnt my original program. it is a test. (can I use serial comminication) and get code for copy+paste from my previous program . also you are right about ossicilator. Iwill remove internal command. thanks all for I get your time and sorry for my bad english

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


    Did you find this post helpful? Yes | No

    Default

    And oups i just notice something interesting in the 12F config file about the config fuses...
    Quote Originally Posted by M12F675.INC
    INTOSC equ 3FF80005h ; XX XXXX XXXX X101
    INTRC_OSC_CLKOUT equ 3FF80005h ; XX XXXX XXXX X101
    INTOSCIO equ 3FF80004h ; XX XXXX XXXX X100
    INTRC_OSC_NOCLKOUT equ 3FF80004h ; XX XXXX XXXX X100
    Where is the INTRC_OSC listed... oups. Might be another problem source.

    EDIT: Great to know it's working now. Don't worry about your english... it could be reaaallllly worst. I'm french and it's hard for me as well.
    Last edited by mister_e; - 12th March 2006 at 22:58.
    Steve

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

Similar Threads

  1. Replies: 33
    Last Post: - 19th March 2010, 03:02
  2. Dynamic USB Serial Number (PIC18F4550)
    By awmt102 in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 16th July 2009, 17:03
  3. PIC18F4680 to PC via MAX232 (RS232 serial) no output
    By opticsteam1 in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 14th April 2008, 20:39
  4. interfacing to the pc serial port
    By kelangfei in forum General
    Replies: 4
    Last Post: - 7th October 2007, 22:35
  5. Serial LCD on 12F675
    By anj in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 31st March 2004, 23:11

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