how do i make sure sx key is still functioning?
Hi there
I get SX/B notice me that SX key can't be found in·COM port after few times of code writing.
Then SX key never work up anymore, how do I make sure SX key is funciton or dead?
and I also found·a problem that same code running in debug mode and run mode has different result:
· the byte value is different when sending out to RS-232. (the result running under debug mode is correct, but not in full run mode)
·Dose this happen? Or may I done things wrong?
I am·shifting from using BS2 to SX, anything I should notice?
Thanks.
·
I get SX/B notice me that SX key can't be found in·COM port after few times of code writing.
Then SX key never work up anymore, how do I make sure SX key is funciton or dead?
and I also found·a problem that same code running in debug mode and run mode has different result:
· the byte value is different when sending out to RS-232. (the result running under debug mode is correct, but not in full run mode)
·Dose this happen? Or may I done things wrong?
I am·shifting from using BS2 to SX, anything I should notice?
Thanks.
·
Comments
Make sure you power supply is not dipping below 5.0 volts when the SX-Key start up.
If you are using the OSC4MHZ setting on the device line, then serial communication will not work correctly because the internal oscillator is only +/- 8% accurate. It WILL work when debugging because when you are debugging the SX-Key supplies the clock and the SX-Key is very accurate.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Cheap used 4-digit LED display with driver IC·www.hc4led.com
Low power SD Data Logger www.sddatalogger.com
SX-Video Display Modules www.sxvm.com
Stuff I'm selling on ebay http://search.ebay.com/_W0QQsassZhittconsultingQQhtZ-1
"People who are willing to trade their freedom for·security deserve neither and will lose both." Benjamin Franklin
·
It really reacts as you said.
Later on I added an external 20MHz crystal to it,
but SX run in a unconstant pace, and even go to a stop (i toggled an LED to monitor it).
Do i miss anything?
Here is what i set to clock directives
DEVICE SX28, OSCXT2, TURBO, STACKX, OPTIONX
FREQ 20_000_000
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Kelvin Liao
Can you post your code ?
Also do you have a 10K resistor on /MCLR to Vdd ?
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Cheap used 4-digit LED display with driver IC·www.hc4led.com
Low power SD Data Logger www.sddatalogger.com
SX-Video Display Modules www.sxvm.com
Stuff I'm selling on ebay http://search.ebay.com/_W0QQsassZhittconsultingQQhtZ-1
"People who are willing to trade their freedom for·security deserve neither and will lose both." Benjamin Franklin
·
I do attach a 10k resistor on /MCLR to vdd.
The purpose of my code is to send data to a COM port by routing through MAX232 driver.
The same code is doing by BS2 very well, and doing correctly on SX debug mode.
Here is code below, sending out characters a~z via Max 232, it's just a test.
Start:
tris_a.0=1
tris_a.1=0
tris_a.2=1
tris_a.3=1
i VAR Byte
char VAR Byte (1)
i=0
inchar(0)=0
Main:
char(0)=i+"a"
SEROUT RA.1 ,T2400,char(0)
PAUSE 200
toggle rb.0
i=i+1
i = i // 26
GOTO Main
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Kelvin Liao
The VAR lines should be done before the code.
"TRIS_A.0 = 1" is not valid. Use "INPUT" or "OUPUT".
I assume "inchar(0) =0" should be "char(0) = 0"
Try this:
DEVICE SX28, OSCXT2, TURBO, STACKX, OPTIONX
FREQ 20_000_000
i VAR Byte
char VAR Byte (1)
PROGRAM Start
Start:
OUTPUT RA.0
OUTPUT RA.1
INPUT RA.2
INPUT RA.3
i=0
char(0)=0
Main:
char(0)=i+"a"
SEROUT RA.1 ,T2400,char(0)
PAUSE 200
toggle rb.0
i=i+1
i = i // 26
GOTO Main
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Cheap used 4-digit LED display with driver IC·www.hc4led.com
Low power SD Data Logger www.sddatalogger.com
SX-Video Display Modules www.sxvm.com
Stuff I'm selling on ebay http://search.ebay.com/_W0QQsassZhittconsultingQQhtZ-1
"People who are willing to trade their freedom for·security deserve neither and will lose both." Benjamin Franklin
·
Thanks again,
As you said doing "tris_a.0=1" is invalid, I wonder if you are telling me that doing so won't take any effect on INPUT/OUTPUT register,
Or, this command is obsoleted and being replaced by INPUT command?
The command seems correct syntactically.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Kelvin Liao