Hi can someone look at this file please its not working. i have had flowcode for 11 months and not any projects done yet.
I am getting a bit stressed by now.
Your last icon is : "LCD Display : PrintString (string)"
If you want to see the received data the last icon must be :
"LCD Display : PrintNumber (Retval)".
About your second post
bit 7 of register 0 is Clock Halt, it must be "0" .
Please do not double post. You have created two forum posts with the same title "ds1307". Double posting is a big no no and may get you banned from the forum.
Also you cannot blame other forum users for your stress. If you need help with specific problems then why not detail the problems your having in full. Doing so may help you to understand what is going wrong rather then simply saying help me im stuck and I've given up.
i have been able to read and write to a ds1307 can someone tell me how to display hh/mm/ss on 7segment display as i am not sure how to start my code. can someone list steps i have to do so that i can do this
There are also some good examples of controlling the 7segment displays in the Flowcode examples download available from the Flowcode CD or the main Flowcode product page.
If you want to initialize it yourself ( and the RTC keeps the right time thanks to the battery).
see the attached file.
Load my file, reset the pic at the right hour then load your program.
(My DS1307 is an "homemade" Eblock)
The file is not tested on hardware but the simulation with Proteus is OK.
If the DS1307 is to be intialized by the user , it's little bit longer.
It looks like the attached program is complete - init time and then time display
Can I load the program with init enabled ( time settings like like they are HEX) and then after initial run on the PIC , reload with the init call disabled so it does not continually reset the time
Also, which pin on the 887 are you using for the I2C Data Line?
Also, I am using V4 of flowcode
I greatly appreciate your efforts - I have been looking for a good I2C program to learn from and this may be it - always good to start with an excellent example.
Wired up everything and loaded the 887 with your V2 code. Getting 00:00:00 on the LCD - not changing. In your code was the CH bit set properly? This is from the DS1307 datasheet
Bit 7 of Register 0 is the clock halt
(CH) bit. When this bit is set to 1, the oscillator is disabled. When cleared to 0, the oscillator is enabled. On first
application of power to the device the time and date registers are typically reset to 01/01/00 01 00:00:00
(MM/DD/YY DOW HH:MM:SS). The CH bit in the seconds register will be set to a 1. The clock can be halted
whenever the timekeeping functions are not required, which minimizes current (IBATDR).
SQW/OUT needs a pull up.
But if bit CH is still at 1, there will be nothing on SQW.
- Take a look at SCL and SDA with an oscilloscope. (The idle state must be 1.)
If there is no aknowledge, the read value is 255 (and display 45 or 85) and you get 00
Did you modify the value of the init time (init_min ...) ?
read Switch
if Switch = 1 then
read SEC (already done)
SEC = SEC - 1 ( warning SEC must be >= 0)
write SEC
OR
read Switch
if Switch = 1 then CH = 1 else CH=0
( CH : Clock Halt, bit 7 of SECond register)
You must read SEC then masking (CH=1 : SEC = SEC OR 0x80 ; CH =0 : SEC = SEC AND 0x7F) and writing SEC
(I think this macro must be in the "Init" macro but not in the main loop. But it depends on what you want to do)
I am not understanding what to do can you please explain to me in detail please or please alter the file for me and i will try to then to alter the hours and mins.
Regards Stephen.
can someone help me out
I have got as far as using a switch on port a of micro and counting/ but what do i do to make this switch alter the seconds on a ds1307. do i just do a count to 59 and sent it to the seconds reg on a ds1307/ or do you do this another way. i am not sure how to go on about this.