MCSPlus serial interface to EasyPIC6 not working?


Closed Thread
Results 1 to 34 of 34

Hybrid View

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

    Question MCSPlus serial interface to EasyPIC6 not working?

    Am not able to get serial communication from MCSPlus with EasyPic6 while running program on 18F4550.
    I set the SW6 and SW7 for RC7 & RC6 respectively per the User Manal and MCU data sheet for the EUSART in the 18F4550. I also made sure the host computer had the COM1 serial interface set to 9600 BPS, 8 data bits, no parity and one stop bit (8N1) .
    The MCU was programmed using MCSPlus as the editor, PICBASICpro as the compiler, and MPASM as the assembler to create a .hex file, which was then burned into the MCU using a USB interface from PICFLASH to the EasyPIC6.
    After programming I have then been trying to use ICD that is built into MCSPlus to step the source code and monitor variable values, which requires the serial interface connection between the MCSPlus host and the EasyPIC where the program is running in the PIC18F4550. I keep getting a serial interface timeout when I start the ICD in MCSPlus even though I have made sure the seral interface is defined in the code and the PC's serial settings have been set to match the MCSPlus settings of COM1.
    Can you please advise from above info what I am doing wrong that is causing the serial interface to timeout without connection??

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

    Default

    Does the easypic hava a level shifter (RS232) chip? If not you will need one using the PIC's USART.

    And

    with out seeing your configs and code we have no way of knowing if the chip is running at the speed you think it is.
    Dave
    Always wear safety glasses while programming.

  3. #3
    Join Date
    Mar 2009
    Location
    Colorado
    Posts
    378

    Question Answers to your questions and here are the configs

    Quote Originally Posted by mackrackit View Post
    Does the easypic hava a level shifter (RS232) chip? If not you will need one using the PIC's USART.
    Yes it has a MAX202 chip installed on the EASYPIC6 board.

    with out seeing your configs and code we have no way of knowing if the chip is running at the speed you think it is.
    Sorry about that...I see now I referenced my configs but forgot to include them. Here they are. One other relevant piceof info: the Easyic6 has a 8 MHz crystal installed for the MCU. I realize the DEFINE in the code must tell the compiler what the MCU clock is, and in this case I intend on this code using a USB interface, which is set by configs for the 48 MHz USB clock. Therefor the DEFINE to tell the MCU it is a 16 MHz MCU clock.
    I have also tried both HYPERTERM and the USART Terminal that comes with mikroelectronica's EasyPic6 to see if the terminal makes a diference....they both never connect and timeout.
    Would appreciate any advice you can give me.

    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

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

    Default

    Try defining the OSC at 48.
    I am not near my data sheets , on a phone, so I am not sure if you have the PLL correct. But if you do have it PLLed to 48 then that is what you set the define as.

    I use the same chip with a 4 external and run it at 48.
    Last edited by mackrackit; - 4th March 2010 at 02:56.
    Dave
    Always wear safety glasses while programming.

  5. #5
    Join Date
    Jul 2003
    Posts
    2,405

    Default

    DEFINE OSC 16 should work with your config settings. If you're trying to use the MCS+ ICD, make sure you compile with the ICD/Compile button. If you're just trying to verify the connection with HSEROUT, then use the normal Compile button.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  6. #6
    Join Date
    Mar 2009
    Location
    Colorado
    Posts
    378

    Default Tried your suggestons..no success

    I tried both 48 and 16 MHz defines and also made sure the recompiles were with just the Compile button and not the Compile/ICD button.
    I also generated a simpler program to test the serial inteerface that just reads the HSERIN from the PC host and then resends the same received character to the PC host with HSEROUT (see included code below). The PC host hyperterminal says the sends are going out, but never receive back any resends from the PIC. I also included in the HSERIN statement a timeout to a label that blinks LEDs as an error if timeout occurs. It does, so it confirms that the serial interface is not working and is timing out.
    Almost seems like a hardware failure on the EasyPic6 side, but I don't want to RMA the EasyPic6 all the way back to Rumania to have them check/repair the unit due to the time delays and the cost....the EasyPic6 is my development board....just wish I could get the serial interface to it working so I could then use the MCSPlus ICD debugger with it.
    At this point I am really baffled. Any other suggestions as to how I can verify the serial interface?

    Code:
    ' -----------------------[ Program Description ]--------------------------
    ' Program is for a PIC18F2550/4550 & was tested in an EasyPic6 board.
    ' PICBASIC PRO program to send and receive from the hardware serial port
    ' LEDs count characters and flash error if none received for 10 seconds   
    '                   
    ' -------------[ Revision History ]--------------------------------------
    ' Version 1.0   Started on 03/04/2012
    
    '--------------[ Define EEPROM usage ]-----------------------------------
    
    ' -----[ Device Declaration ]---------------------------------------------
    ;--- if you un-comment these, you must comment the ones in the .inc file--
    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
    
    Include "Modedefs.Bas"
    INCLUDE "ALLDIGITAL.pbp"    ' Sets all registers for digital ops.
                                ' User must make sure the AllDigital.pbp file 
                                ' is in same directory location as this source
                                ' code before compiling.
        'DEFINE SHOWDIGITAL 1    ' When uncommented will show analog settings
                                ' in Assembler Results window                        
    
    DEFINE OSC 16
    DEFINE I2C_SLOW 1   ' Set i2c to the standard speed
    DEFINE I2C_HOLD 1   ' Enable recieving i2c device to pause communication
          
    '--------------[ Declare Variables, Aliases & Constants ]---------------  
        ' Variables & Aliases for Pins
        ' ===============================================
    char	Var	Byte		' Storage for serial character
    cnt	    Var	Byte		' Storage for character counter  
    
        ' Constants
        '==========
        
    ' Initialize Hardware 
    ' =================== 
        'Set registers
       	TRISB = %11001111	' Set PORTB.4,5 to outputs
    	PORTB = 0		    ' Turn off LEDs
    	cnt = 0			    ' Zero character counter 
     
        ' Setup Hardware for uart
        ' =======================
            'DEFINE HSER_BAUD 9600 
            'DEFINE HSER_RCSTA 90h
            'DEFINE HSER_TXSTA 24h
            'DEFINE HSER_CLROERR 1
    
        ' * NOTES for use with EasyPic6 development board:
       ' Set SW7.1 on for RC7 = RX and SW8.1 on for RC6 - TX
        'For use with COG 2x16 LCD:
        '   - Turn on Port Expander switches SW6.1,SW6.2,SW6.3,SW6.4 & SW6.5.
        '   - Turn on COG LCD 2x16 switches SW10.1,SW10.2,SW10.3,SW10.4,SW10.5 
        '     and SW10.6.
    
    ' Set EUSART configuration for serial interface to EasyPic6
    ' For MCSPlus ICD debugging only....comment out for operations
        'TRISC.6 = 1
        'TRISC.7 = 1
        'RCSTA.7 = 1
    
    '--------------------[ Begin Main Program Loop ]------------------------
    mainloop:   
        PAUSE 100 ' Without this PAUSE, there's nothing to keep the Watch Dog 
                  ' Timer clear. LOW & GOTO don't generate CLRWDT instructions.
                  ' See www.picbasic.co.uk/forum/showthread.php?p=84722#post84722 
        Hserin 10000, allon, [char]	' Get a char from serial port..if timeout go
                                    ' to label as error
    
        Hserout [char]		' Send char out serial port
    
    	cnt = cnt + 1		' Increment character count
    	PORTB = cnt << 4	' Send count to LED
    
    	Goto mainloop		' Do it all over again
    
    allon:	PORTB = %00110000	' Error - no character received
    	Pause 500		' Blink all LEDs
    	PORTB = 0
    	Pause 500
    	Goto allon
    
    End     ' Safety measure to insure program stops if reaches here

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, 02:48
  2. 32-bit Quadrature Counter With Serial Interface
    By precision in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 10th June 2008, 02:49
  3. Serial interface with RFID reader
    By brid0030 in forum Serial
    Replies: 8
    Last Post: - 23rd January 2007, 06:23
  4. Replies: 0
    Last Post: - 25th November 2005, 14:35
  5. PIC16F877 to RFID Module Serial Interface
    By koossa in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 17th May 2005, 06: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