PDA

View Full Version : Serial Communication Problems (Strange!!)



Armando Herjim
- 20th June 2006, 21:50
Hello everybody! I´d like someone to help here please I really need it!! Here the situation. I´m working with a Pic 18F4550, I´m running a 40 Mhz speed and I want to use the Tx and Rx but, when I connect the serial cable to de Max232 and to the serial port on my computer, it seems that my MicroController die. Even if I don´t have it configurated to serial communicacion it goes off. I though it would be the max232 circuit I was using but when I used another one it just happened the same. I am desesperate and do not know what to do or what the posibly problem could be so, if someone could please give a tip to me I´d be very very gratefull, seriously.
Thanks to all of you who took a little time to read this. Oh, I´m sending here the code which I wrote just as a test to see if it´d work out. I´m also sending the .INC file. Thank you very much.

Have a nice day!

Armando Herjim.

--------------------------------------------------------------------------
18F4550.INC
--------------------------------------------------------------------------
;************************************************* ***************
;* 18F4550.INC *
;* *
;* By : Leonard Zerman, Jeff Schmoyer *
;* Notice : Copyright (c) 2004 microEngineering Labs, Inc. *
;* All Rights Reserved *
;* Date : 12/31/04 *
;* Version : 2.46 *
;* Notes : *
;************************************************* ***************
NOLIST
ifdef PM_USED
LIST
"Error: PM does not support this device. Use MPASM."
NOLIST
else
LIST
LIST p = 18F4550, r = dec, w = -311, f = inhx32
INCLUDE "P18F4550.INC" ; MPASM Header
CONFIG USBDIV = 1
CONFIG CPUDIV = OSC3_PLL4
CONFIG PLLDIV = 1
CONFIG IESO = ON
CONFIG FCMEM = OFF
CONFIG FOSC = HSPLL_HS
CONFIG PBADEN = OFF

;__CONFIG _CONFIG1L, _PLLDIV_3_1L & _CPUDIV_OSC1_PLL2_1L
;__CONFIG _CONFIG1H, _FOSC_XT_XT_1H
;__CONFIG _CONFIG2H, _WDT_ON_2H & _WDTPS_128_2H
;__CONFIG _CONFIG3H, _PBADEN_OFF_3H
;__CONFIG _CONFIG4L, _LVP_OFF_4L & _ICPRT_OFF_4L & _XINST_OFF_4L
NOLIST
endif
LIST
EEPROM_START EQU 0F00000h
BLOCK_SIZE EQU 32

-----------------------------------------------------------------------------------------------------------------------------------------------------

--------------------------------------------------------------------------
Prueba.bas
--------------------------------------------------------------------------
INCLUDE "MODEDEFS.BAS"
OSCCON = $D0 'Set OSCILLATOR CONTROL REGISTER TO 1101 0000
'Oscillator control register para seleccionar el modo de clock

DEFINE HSER_RCSTA 90h
DEFINE HSER_TXSTA 24h
DEFINE HSER_BAUD 115200
DEFINE HSER_SPBRG 25
DEFINE OSC 40

da var byte[10]

;-----------------------------------------------------------------

pause 200

main:
high porta.2
pause 500
high portb.0
pause 500
low porta.2
pause 500
low portb.0
pause 500

;---------------------------------------------------------------

high portb.7
hserout ["Armando 130, 256 epacion a ·$/&$&( ;", 10, 13]
pause 500
low portb.7

;----------------------
pause 500
;----------------------

high portb.7
hserin [str da\10]
low portb.7
;-----------------------
hserout [10,13]
hserout [str da\10 ,10, 13]



GoTo main
-----------------------------------------------------------------------------------------------------------------------------------------------------

thanks a lot!!

Bruce
- 20th June 2006, 23:46
My guess would be a problem with the MAX232 wiring. Check your wiring against this schematic http://www.microengineeringlabs.com/downloads/LABXUSCH.PDF