Sonsivri
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
May 17, 2024, 08:57:29 20:57


Login with username, password and session length


Pages: [1]
Print
Author Topic: commands line error  (Read 3271 times)
0 Members and 1 Guest are viewing this topic.
schlen
Newbie
*
Offline Offline

Posts: 11

Thank You
-Given: 2
-Receive: 0


« on: December 30, 2007, 12:24:01 00:24 »

I try to use some lines from help menu, but it gives error message. i don't understand how to correct it.

' Receive values serially and timeout if no reception after 1 second (1000ms).
 DEVICE 16F877
 XTAL = 4

 HSERIAL_BAUD = 9600        ' Set baud rate to 9600
 HSERIAL_RCSTA = %10010000  ' Enable serial port and continuous receive
 HSERIAL_TXSTA = %00100000  ' Enable transmit and asynchronous mode
 HSERIAL_CLEAR = ON         ' Optionally clear the buffer before receiving

 DIM VAR1 AS WORD

Loop:
 HSERIN , 1000 , Timeout , [VAR1], '[Modifiers , Variable {, Variable... }] ' Receive a byte serially into VAR1 ==>line 23
 PRINT DEC VAR1 , " "      ' Display the byte received
 GOTO Loop                 ' Loop forever
Timeout:
 CLS
 PRINT "TIMED OUT"         ' Display an error if HSERIN timed out
 STOP
 END


 ERROR [line 23] : Value Expected! (sample.bas)
Logged
hemlig
Translator
Active Member
***
Offline Offline

Posts: 168

Thank You
-Given: 26
-Receive: 50



« Reply #1 on: December 30, 2007, 12:46:07 00:46 »

I made some changes in your code and it is compiling without errors.
I think you forgot the word "define" and used the word "print" instead of "debug"
(you could use serout or lcdout if you use a lcd)
I also changed the "dim" and changed the variable to v.

I hope this will help you a step forward.


Code:
' Receive values serially and timeout if no reception after 1 second (1000ms).
 'DEVICE 16F877
 'XTAL = 4
 define osc 4
 
 define HSERIAL_BAUD = 9600        ' Set baud rate to 9600
 define HSERIAL_RCSTA = %10010000  ' Enable serial port and continuous receive
 define HSERIAL_TXSTA = %00100000  ' Enable transmit and asynchronous mode
 define HSERIAL_CLEAR = ON         ' Optionally clear the buffer before receiving
 ' changed VAR1 ==> v
 v var WORD 'var1

Loop:
 HSERIN 1000, Timeout,[v]', '[Modifiers , Variable {, Variable... }] ' Receive a byte serially into VAR1 ==>line 23
 debug DEC v , " "      ' Display the byte received
 GOTO Loop                 ' Loop forever
Timeout:
 CLS
 debug "TIMED OUT"         ' Display an error if HSERIN timed out
 STOP
 END


 'ERROR [line 23] : Value Expected! (sample.bas)
Logged

If it work don't fix it!
hemlig
Translator
Active Member
***
Offline Offline

Posts: 168

Thank You
-Given: 26
-Receive: 50



« Reply #2 on: December 30, 2007, 12:57:20 00:57 »

@schlen

I am not going to attach a picture as you cannot see links yet because you have less than 7 posts.

But in every header of posts there is an icon on the upper right side with the words and a red star.
You need to learn this rule really fast or someone might give you a warning or ban you.
That would be sad.


« Last Edit: December 30, 2007, 01:00:26 01:00 by hemlig » Logged

If it work don't fix it!
Pages: [1]
Print
Jump to:  


DISCLAIMER
WE DONT HOST ANY ILLEGAL FILES ON THE SERVER
USE CONTACT US TO REPORT ILLEGAL FILES
ADMINISTRATORS CANNOT BE HELD RESPONSIBLE FOR USERS POSTS AND LINKS

... Copyright © 2003-2999 Sonsivri.to ...
Powered by SMF 1.1.18 | SMF © 2006-2009, Simple Machines LLC | HarzeM Dilber MC