PDA

View Full Version : End-of-Line and missing colon error



adobejoe
02-18-2010, 02:17 PM
Okay, I know this is probably a lame question, but I am getting an error code 129 "Expected ':' or end-of-line on my program, and I do not know what is going on. Any ideas? Program attached.

Andy

Adrian Schneider
02-18-2010, 05:57 PM
First, you should use {$PBASIC 2.5} instead of {$PBASIC 2.0} to use the PIN declaration.
Second, the variable decNum in line 51 is not declared and never used any more.

Regards
Adrian

adobejoe
02-19-2010, 12:30 PM
Adrian,

I had no idea I needed to change the PBASIC from 2.0 to 2.5 in the second line. Thanks! I found some other undefined variables, and have edited a bit. Now I am getting a "Undefined symbol" on the READ BURST command in my subroutine Get_Time:. NOw, there is also a RdBurst command, so I am a bit confused of which is correct? I assume this is the command to read a time/date stamp from the DS1302.

Andy

Mike Green
02-19-2010, 01:47 PM
There is nothing defined for BURST and "READ BURST" doesn't make any sense. "RdBurst" is a command sent to the DS1302, but I'd have to look at the datasheet to figure out how it's used. Where did you get your "Get_Time" routine?

adobejoe
02-21-2010, 10:27 AM
When I read the datasheet it describes burst mode as being able to go to either the clock/calender registers or the RAM (random access memory), I guess depending upon bit address. Bit 0 specifies read or write (1/0) and address bits 1 to 5 = logic 1. My Get_Time routine came from a demo by Chris Savage, and I notice that "READ BURST" in the subroutine probably should not be there. I removed it. I understand in theory the whole idea of 8 bits to a byte, nibbles being half a byte (4 bits) and BCD binary coded decimal, and of course HEX is base 16, and I understand the logic of DO loops, IF Then statements, etc, but I really do not understand exactly what the code is doing. At least I know what I want it to do, as in my first comments.

Andy

Mike Green
02-21-2010, 11:20 AM
The way to understand code is to break it into pieces small enough so you can understand each piece. If you don't understand a statement, you read its description in the Manual and look at known working examples until you understand them. It's often helpful to work through small examples on paper. If you have specific questions or don't understand something in the Manual, do ask, but just saying you don't understand doesn't help.

sam_sam_sam
02-21-2010, 11:22 AM
Get_Time:
· READ BURST··························· ' DS1302 Burst Read <<<<<<.......This is not need
· HIGH CS1302·························· ' Select DS1302
· SHIFTOUT DataIO, Clock, LSBFIRST, [RdBurst]
· SHIFTIN DataIO, Clock, LSBPRE, [secs, mins, hrs, date, month, day, year] 'clock activated,and will read at each loop
· LOW CS1302··························· ' Deselect DS1302

DEBUG HOME, HEX2 hrs, ":", HEX2 mins, ":", HEX2 secs·

RETURN

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
··Thanks for any·http://forums.parallax.com/images/smilies/idea.gif·that you may have and all of your time finding them http://forums.parallax.com/images/smilies/smile.gif

·
·
·
·
Sam

adobejoe
02-22-2010, 12:19 PM
Sam,

·Okay I modified file and it is now going through the DEBUG interaction, taking date month, etc input but it kind of stalls at the hours/minutes/seconds input. Your change noted, except where to place the "DEBUG HOME......" line?· I understand my subroutines, in order of operation to be something like

1) Set_Mode --this takes user input on date, time, etc to initialize values to DS1302 (RAM?)

2)Set_Time--this must do a burst write to the DS1302, and start the clock?

3)RTC_Out--this must be Real-Time-Clock, something to do with the DS1302 clock

4)Get_Time--this must do a burst read of time,date data from DS1302

5)Advance--this is a routine to switch or advance pin 4 for 3 seconds, advancing a linear actuator.

6)Retract--this is a routine to switch or retract pin 6 for 24 seconds, retracting a linear actuarot.

Am getting there, I think. comments appreciated.

Andy