PropBasic and RTC
Discovery
Posts: 606
in Propeller 1
I have a system running the Propeller coded in "C" that includes an RTC in one COG.
Is there a PropBasic program that does the same thing...setting and reading year, month, date, day, hour, minute, and seconds?
I really like PropBasic and would like to rebuild these systems using PropBasic.
Sincerely,
Discovery
Is there a PropBasic program that does the same thing...setting and reading year, month, date, day, hour, minute, and seconds?
I really like PropBasic and would like to rebuild these systems using PropBasic.
Sincerely,
Discovery
Comments
Can't even find the DS1307 module right now. Will dig deeper over the weekend.
Making a COG count seconds is pretty simple, although you do need a bit of code to initialize the correct time at the start.
Has this been accomplished?
Sincerely,
Discovery
Bean
Sincerely,
Discovery
My first step in using the program information you provided is to: (1) set the clock time in the COG and (2) read the hours, minutes, and seconds from the main program to activate and deactivate propeller outputs at specific times during the course of a 24 hour day. I have no use for the display at this time.
What additions or changes do I make to accomplish this task.
Sincerely,
Discovery
I figured it out...thanks.
Discovery
I inserted into your program a HIGH LED1 instruction just after the DO LOOP UNTIL instruction so that I can tell the Propeller Activity Board propeller clock is working. In the main LMM section I compare the Hours, Minutes, and Seconds to turn ON and OFF I/O. Once in a while it works. Most of the time the program does not get out of the DO LOOP UNTIL block. After about twelve or thirteen attempts...the clock synchronizes the seconds and the program runs perfectly well.
Have you encountered this problem?
Sincerely,
Discovery
Discovery
With the Propeller Activity Board powered by a 12 volt external power source, the prop was loaded with the program. However, the second synchronization code was modified somewhat. The DO and LOOP UNTIL instructions were removed. The clock ran right off and kept excellent time except it took 2 seconds for the clock to start. So, there is a 2 second constant error. It is important to disconnect the USB cable from the computer because when the computer shuts OFF and you power the computer back ON...the prop coded is removed. This modification appears to work fine.
Discovery
Every so often the code that is sent to the propeller will not execute. The code compiles and down loads but does not run. When the code starts, I turn on LED1 to make sure that the code is actually running. When I made the change to remove the DO LOOP UNTIL instructions, the Propeller would not execute. I removed the USB cable from the computer, reinserted it, ran the program, but it would not execute. I turned cycled the power on the Activity board but the same result occurred. Other programs that ran fine a few minutes before would not execute either.
I did notice that when I shut cycled power on the computer and bring PropellerIDE back on line all the programs run even the clock program that has the seconds synchronizer in it. The Propeller develops this state every so often but when I restart PropellerIDE it clears the Propeller and programs then run on the Propeller.
I can now get the clock program to run and control the I/O for clock start and stop times.
Discovery
I suspected that this was a ViewPort quirk so I simply hit the board's hardware reset, prior to downloading. No biggie for me.
Testing shows that pressing the reset, removing the USB cable, and moving the power switch to OFF will not clear the problem. Code is downloaded with no error but the propeller will not execute the code. The only method I found to get the propeller to execute the code after it encounters this condition is to reload the PropellerIDE and download the code again...then the propeller executes the code correctly. Strange!
Sincerely,
Discovery
Your PropBasic clock program is working perfectly. It keeps time really well.
The code is simple...and elegant, thank you.
My next step is to write and read data to/from the removable memory on the Propeller Activity Board using PropBasic...half a gigabyte or more. What coding would you recommend. I would like the code to run as fast as possible with PropBasic.
Sincerely,
Discovery
If it is SD card, I'm afraid I haven't done any coding to read/write an SD card.
It would be quite a project, and I just don't have the time right now.
Bean
DenO
Bean...rats, I was hoping.
One of the guys on the FORUM spent a great deal of time and some of my money to write the "C" code to write and read the SD memory on the Propeller Activity Board. The code is not pretty but it does the job. I cannot stand "C" but like PropBasic.
I understand that you are very busy. Maybe some time in the future perhaps?
Sincerely,
Discovery
What do you think the chances are that I can convert line-by-line the "C" code I have for Writing/Reading the SD memory into PropBasic code?
Sincerely,
Discovery
Discovery
I downloaded and unpacked the above 7z file and put it into the zip file below.
Thank you.
Discovery
By any chance, would you happen to have a short PropBasic program that uses the library functions you sent to write and read some data onto and off of the SD?
Sincerely,
Discovery
Take a look at the https://forums.parallax.com/discussion/122615/propbasic-sd-card forum entries. These entries appear to be posted by the creator of the sd.lib library
Mike R.
Now I can get started.
Sincerely,
Discovery
I don't suppose there is an easy way to adjust the clock to be precise?
Sincerely,
Discovery
How fast? Since crystals are involved, they have a certain PPM tolerance.