MCSPlus serial interface to EasyPIC6 not working?


Results 1 to 34 of 34

Threaded View

  1. #34
    Join Date
    Mar 2009
    Location
    Colorado
    Posts
    378

    Default Ran your code

    Quote Originally Posted by mackrackit View Post
    Below are the setting for 9600 baud at 16MHz
    Code:
    RCSTA = $90 ' Enable serial port & continuous receive
    TXSTA = $20 ' Enable transmit, BRGH = 0
    SPBRG = 25  ' 9600 Baud @ 0.16%
    You have the ones in your code commented out.

    Run this code and type numbers at the keyboard.
    Code:
    ASM ; 18F2550/4550, 8mhz crystal
       __CONFIG   _CONFIG1L, _PLLDIV_2_1L & _CPUDIV_OSC4_PLL6_1L & _USBDIV_2_1L
       __CONFIG   _CONFIG1H, _FOSC_HSPLL_HS_1H
       __CONFIG   _CONFIG2L, _PWRT_ON_2L & _BOR_OFF_2L & _VREGEN_ON_2L
       __CONFIG   _CONFIG2H, _WDT_ON_2H & _WDTPS_512_2H
       __CONFIG   _CONFIG3H, _PBADEN_OFF_3H ; PortB resets as digital
       __CONFIG   _CONFIG4L, _LVP_OFF_4L & _XINST_OFF_4L
    ENDASM
    DEFINE OSC 16
    
    ADCON1 = 15		' All I/O pins digital
    PORTB.6 = 0                 ' Turn off the LEDs PORTB.7 = 0
    
    X VAR BYTE
        START:
        RCSTA.4 = 0 : RCSTA.4 = 1
        RCSTA=$90:TXSTA=$20:SPBRG=25
        HSERIN [DEC X]
        HSEROUT [DEC X,$d,$a]
    GOTO START
    Mackrackit, I created a .pbp file from your above code with a slight modification where I inserted a LED turn on just after the HSERIN and just after the HSEROUT statements. See the code below. Then when running the code and typing characters on the keyboard I do not see these respective lights come on in the EasyPic6. This says the HSERIN and the HSEROUT statements are never executing when the code is running and the PC terminal is connected. This implies a hardware failure somwhere in the EasyPic6 serial interface circuitry....do you agree???
    Code:
    ASM ; 18F2550/4550, 8mhz crystal
       __CONFIG   _CONFIG1L, _PLLDIV_2_1L & _CPUDIV_OSC4_PLL6_1L & _USBDIV_2_1L
       __CONFIG   _CONFIG1H, _FOSC_HSPLL_HS_1H
       __CONFIG   _CONFIG2L, _PWRT_ON_2L & _BOR_OFF_2L & _VREGEN_ON_2L
       __CONFIG   _CONFIG2H, _WDT_ON_2H & _WDTPS_512_2H
       __CONFIG   _CONFIG3H, _PBADEN_OFF_3H ; PortB resets as digital
       __CONFIG   _CONFIG4L, _LVP_OFF_4L & _XINST_OFF_4L
    ENDASM
    DEFINE OSC 16
    TRISB = %00001111	' Set PORTB.4,5,6,7 to outputs as test LEDs
    
    ADCON1 = 15		' All I/O pins digital
        PORTB.6 = 0                 ' Turn off the LEDs
        PORTB.7 = 0
    
    X VAR BYTE
        START:
        RCSTA.4 = 0 : RCSTA.4 = 1
        RCSTA=$90:TXSTA=$20:SPBRG=25
        HSERIN [DEC X]
        PORTB.6 = 1         ' Turn on PortB.6 LED if this statement is executed
                            ' as test of receiving a character
        HSEROUT [DEC X,$d,$a]
        PORTB.7 =1          ' Turn on PortB.7 LED if this statement is executed
                            ' as test of HSEROUT having sent a character
    GOTO START
    Last edited by jellis00; - 5th March 2010 at 05:16. Reason: Add the code

Similar Threads

  1. Please help with EDE702 - Serial to LCD interface
    By Tomexx in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 30th October 2008, 03:48
  2. 32-bit Quadrature Counter With Serial Interface
    By precision in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 10th June 2008, 03:49
  3. Serial interface with RFID reader
    By brid0030 in forum Serial
    Replies: 8
    Last Post: - 23rd January 2007, 07:23
  4. Replies: 0
    Last Post: - 25th November 2005, 15:35
  5. PIC16F877 to RFID Module Serial Interface
    By koossa in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 17th May 2005, 07:03

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