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




Bookmarks