PDA

View Full Version : 12F675: DEC modifier not accepted



jswayze
- 31st August 2005, 05:05
I get a "bad expression" error in Microcode Studio on the SEROUT line below. When I remove the "DEC" modifier all works fine. Is there any reason DEC shouldn't be working here?

I'm using Microcode Studio 2.2.1.1

Thanks!

Jeff



@ DEVICE INTRC_OSC, WDT_OFF, MCLR_OFF, PWRT_ON
INCLUDE "modedefs.bas"
define OSC 4
result VAR word 'A/D CONVERSION RESULT STORAGE BYTE
ANSEL=%00100001 'SET GP.0 TO ANALOG INPUT, Fosc/32, ALL ELSE = DIGITAL I/O

MAIN:
GOSUB GETADC 'SETUP A/D
PAUSE 1000 'PAUSE FOR 1 SECOND
SEROUT GPIO.1,N2400,[dec result] 'SEND A/D CONVERSION RESULT TO THE PC SERIAL PORT
PAUSE 1000 'PAUSE FOR 1 SECOND
GOTO MAIN

GETADC:
adcin 0,result
return

Ioannis
- 31st August 2005, 07:27
Did you tried Serout2 ?

Ioannis

Chris Mayhew
- 31st August 2005, 10:42
Did you tried Serout2 ?

Ioannis

I did, and it compiles OK with SEROUT2

mister_e
- 31st August 2005, 22:31
The Fabulous Manual says black on white to use # with SEROUT.

Dwayne
- 31st August 2005, 22:49
RTFM???

Some of us just can't see the light at the end of the tunnel....

Dwayne

jswayze
- 1st September 2005, 02:39
You're right... TFM does indeed say "A numeric value preceded by a pound sign ( # ) will send the ASCII representation of its decimal value. For example, if W0 = 123, then #W0 (or #123) will send '1', '2', '3'. "

I glanced through it but missed it since what I was looking for was:

Modifier Operation

{I}{S}BIN{1..16} Send binary digits

{I}{S}DEC{1..5} Send decimal digits

{I}{S}HEX{1..4} Send hexadecimal digits

REP c\n Send character c repeated n times

STR ArrayVar{\n} Send string of n characters


Which is found in the SEROUT2 section.

My bad, and I appreciate the helpful responses.

-Jeff