Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Program Help

Status
Not open for further replies.

Timmymna

New Member
I am trying to write a program for a project which includes a PIC connected to a DS1307 real time clock and 24LC64 serial EEPROM but I can't find anything on writing a Basic program for these. Both will be using I2C and will connected seperately to simplify the program plus I have enough free ports for this. If anyone knows any tutorials or could give me a simple program I would be very greatful :D
 
Timmymna said:
I am trying to write a program for a project which includes a PIC connected to a DS1307 real time clock and 24LC64 serial EEPROM but I can't find anything on writing a Basic program for these. Both will be using I2C and will connected seperately to simplify the program plus I have enough free ports for this. If anyone knows any tutorials or could give me a simple program I would be very greatful :D

I can't help you with BASIC code, but there are I2C routines in my tutorials. Also connecting them separately won't simplify things, it will make it more complicated - I2C is designed (and intended) to connect all devices on a single bus. If you connected them separately you would access them exactly the same as you would on the same bus, but have to do it twice.
 
Thanks for the reply, I've worked it out now:)
I have another question though.
I am reading the value for the month from the real time clock but its as a number such as 0 - jan, 1 - feb, 2 - mar etc, and wanted to write some code so I could display the month name rather than the number. Could I do this with a lookup table or would I have to do something like
if month = 0 then monthname = "jan"
if month = 2 then monthname = "feb"

Any help is much appreciated
 
Timmymna said:
Thanks for the reply, I've worked it out now:)
I have another question though.
I am reading the value for the month from the real time clock but its as a number such as 0 - jan, 1 - feb, 2 - mar etc, and wanted to write some code so I could display the month name rather than the number. Could I do this with a lookup table or would I have to do something like
if month = 0 then monthname = "jan"
if month = 2 then monthname = "feb"

Any help is much appreciated

The classic way would be a string array, but I don't know if your BASIC allows them. Lookup tables generally only return a single byte.
Does your compiler allow Case/End Case statements, you could use that, if not your If/Then solution looks favourite.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top