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.
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.
Yes it has a MAX202 chip installed on the EASYPIC6 board.
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.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.
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
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.
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.
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
Below are the setting for 9600 baud at 16MHz
You have the ones in your code commented out.Code:RCSTA = $90 ' Enable serial port & continuous receive TXSTA = $20 ' Enable transmit, BRGH = 0 SPBRG = 25 ' 9600 Baud @ 0.16%
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 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
Dave
Always wear safety glasses while programming.
On SW7 & SW8 flip everything else to the OFF position leaving only switches #8 on each one ON. Does it work?Set SW7.1 on for RC7 = RX and SW8.1 on for RC6 - TX
In: http://www.mikroe.com/pdf/easypic6/e...anual_v100.pdf the photo in Figure 6-1 shows both DIP
switches for RC6 & RC7 on switch positions #1.
And just below this in Figure 6-2 they show RC6 & RC7 on DIP switch positions #8. Which is right?
Last edited by Bruce; - 5th March 2010 at 03:31. Reason: Which is right?
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 04:16. Reason: Add the code
Bookmarks