New little Project

eclectic

Moderator
there is a problem with the download circuit on the board i have made up, if i programme on the proto board it works fine, then once its transfered it stops sending data back. alos if i programme on the bord i made and then put the chip in the proto board i dosnt send info back.
Can I just check please?

1. Which protoboard do you own? AXE020, AXE022, AXE090

2. On the protoboard, the program to set, then read, the DS1307 now works?

If it works on an assembled board, but not in you own board, then it sounds like wiring.
 
Last edited:

craig008

New Member
its the 28 starter board, which ever one that is. the clock works while attached to starter board but no the made up board, it doesnt seem to download correctly to the made up board. i will start making up a new board tmrw, i will do each bit at a timemaking sure that each bit works as i go.
________
MEDICAL MARIJUANA
 
Last edited:

BCJKiwi

Senior Member
Hi, me again, night has passed.

It seems that this project has become more complicated than it needs to be.
Lets summarise;
Programming and clock work on the 28 proto board - Right?
The thing is that none of these has a clock on it unless you have the add-on clock/LCD board.
We are a little in the dark here. These boards are marked so please advise the model number or post a photo so we can get on the same page.

The basic issue seems to be that;
i2c to the DS1307 clock is not working - right? - but wait, this conflicts with the comment above ???
You have both a (rev-ed?) proto board, and home made board(s).

Things partly work on each but in different ways.

First thing is to focus on one board and stay with it.
The simplest is to use a solderless breadboard for initial sorting out of the circuit before anything gets soldered.

Replicate the download circuit / reset / power supply etc from the proto board onto the breadboard - using batteries simplifies the power supply.
Make sure its working - download a simple program, get back sertxd, flash a led or whatever to prove it.
Then add the DS1307 to the bread board.
test i2c to from the DS1307.
If it doesn't work, find out why - don't switch back and forward between boards - just gets too confusing.
Don't solder anything until it all works on the breadboard.

Sorry if this all seems a bit basic but even for those supposed 'experienced' people it is so easy to miss something along the way.
 
Last edited:

craig008

New Member
it did all work, thats why i built a board for the project. and most of the board i built worked, and then it just seem to stop, not sure why and i cant remember doing anything that would make it stop.

the proto board i have been using for testing the clock is the version 3 2000-02 for the picaxe 28. which s then hooked to a bread board with the clock on it which works fine. the 28x1 seems to reset it self when it get info from another I2C device, no matter if it a clock or an eeprom, it alos does not seem to be sending data back throught the downlaod circuit, so i am gausing there is a problem there some where.

the home made board seem to be the problem, i will start reconstruction today checking each bit as i go, e.i. the downlod circuit then the clock circuit etc etc.
________
Hawaii Marijuana Dispensaries
 
Last edited:

craig008

New Member
I have the I2C part of the circuit oworking fine now, i will get the speaker, switches and display hooked up to make sure it all works.

one moe question tho, with the 24LC16B do i have to use the new slave for each address, ie newslave for 10100000 and then newslave for 10101000? also with this do i have t do an i2csetup comand for ech device at the begining of the programme?
________
Extreme q
 
Last edited:

craig008

New Member
hey you all i thought you may liek to know got it all pretty much in one piece now, i just have to figure out the programme and some sort of audio amp to make it a little loader. thanks for all your help.
________
Halfbaked
 
Last edited:

craig008

New Member
I am about to dig this thrad up again, i have a programme that keeps bugging and i cant figure out why.

while the alarm is set it is fine, after the alarm has gone off and been snoozed and then the alarm switched of, the display flases some of the BCD numbers. also the snooze dosent work after a certian amount of uses in one alarm

Code:
symbol control = b0
symbol temp_byte = b1
symbol temp_m = b2
symbol temp_h = b3
symbol sec = b4
symbol mins = b5
symbol hour = b6
symbol day = b7
symbol date = b8
symbol month = b9
symbol year = b10
'b11-b13 used for some switch counts
symbol Amin = b14
symbol Ahour = b15
symbol snoozetime = b16


init:
	hi2csetup i2cmaster, %11010000, i2cslow, i2cbyte
	hi2cin 0,(sec,mins,hour,day,date,month,year,control)
	sertxd (#sec,#mins,#hour,#day,#date,#month,#year,#control,13,10)	'send data to computer
	if control = %00010000 then main						'check RTC to see if has data
'if the RTC has no data then write new values
	let sec = $00 
	let mins = $00
	let hour = $00 
	let day = $00
	let date = $00
	let month = $00
	let year = $00
	let control = %00010000	'set LED to flash
	sertxd (#sec,#mins,#hour,#day,#date,#month,#year,#control,13,10)	'send data to computer
	hi2cout 0,(sec,mins,hour,day,date,month,year,control)			'wrtie RTC
	pause 20
	
'********************
'***Main Programme***
'********************

main:
	debug
	let pins = %00000001								'Switch on display
	hi2cin [%11010000],0,(sec,mins,hour,day,date,month,year)				'read RTC
	pause 20
	gosub bcd_decimal									'convert data to readible info
	if temp_m <> mins then set_min						'check mins display
	if temp_h <> hour then set_h							'check hour display
	sertxd ("Time: ",#hour,44,#mins,44,#sec,13,10)				'send time to computer	if pin1 =1 and pin6 = 1 then set_alarm
	if pin6 = 1 and pin1 = 1 then set_alarm
	if pin1 = 1 then goto count_t
	if pin6 = 1 then check_alarm							'check for time set
	goto main

'************************
'******Goto Section******
'************************

'**************
'***set mins***
'**************

set_min:
	let b11 = 0
	let pins = %00000000								'Switch off display
	let temp_m = mins
	pulsout 3,10									'reset mins display
	
		set_cm:
			if b11 = mins then main						'check varible to ensure no over flow on display
			let b11 = b11 + 1
			pulsout 1,10							'increse mins display by 1
			if b11 < mins then set_cm
	goto main
	
'***************
'***set hours***
'***************

set_h:
	let b12 = 0
	let pins = %00000000								'Switch off display
	let temp_h = hour
	pulsout 4,10									'reset hour display
	
		set_ch:
			if b12 = hour then main						'check varible to ensure no over flow on display
			let b12 = b12 + 1
			pulsout 2,10							'increse hour display by 1
			if b12 < hour then set_ch
	goto main
	


'************************
'***count for time set***
'************************

count_t:
	let b13 = b13 + 1									'add on for clock chnage count
	if b13 = 10 then goto set_time							'check for clock change
	goto main
	
'**************************
'******///Set Time\\\******
'***including all gosubs***
'**************************

set_time:
	sound 6,(120,10)
set_time1:
	sertxd (#hour,44,#mins,13,10)
	if pin2 = 1 then gosub add_one						'check for value increase
	if pin0 = 0 then set_time1							'check for finish clock change
	goto set_clock									'goto set clock to write new data to the clock
	
add_one:
	let pins = %00000000
	let mins = mins + 1
	pulsout 1,10
	pause 500
	if mins = 60 then gosub add_hour
	let pins = %00000001
	return
	
add_hour:
	let mins = 0
	pulsout 3,10
	let hour = hour + 1
	pulsout 2,10
	if hour = 24 then gosub set_0
	return
	
set_0:
	let hour = 0
	pulsout 4,10
	return
	
'********************
'***Set alarm Time***
'********************

set_alarm:
	'start by displaying current alarm time
	'this needs to be read from eeprom and checked to see if data is present
	
	hi2csetup i2cmaster, %10100000, i2cslow, i2cbyte
	hi2cin [%10100000],1,(Amin)
	hi2cin [%10100000],2,(Ahour)
	pause 20
	if Amin > 60 then gosub Aminsset
	if Ahour > 24 then gosub Ahourset
	
	
	
'*********************
'***show alarm mins***
'*********************

set_Amin:
	let b11 = 0
	let pins = %00000000
	pulsout 3,10
	
		set_acm:
			if b11 = Amin then set_Ahour
			let b11 = b11 + 1
			pulsout 1,10
			sertxd (#b11,13,10)
			if b11 <= Amin then set_acm
	
'**********************
'***show alarm hours***
'**********************

	set_Ahour:
	let b12 = 0
	let pins = %00000000
	pulsout 4,10
	
		set_ach:
			if b12 = Ahour then alarm_set	
			let b12 = b12 + 1
			pulsout 2,10
			sertxd (#b12,13,10)
			if b12 <= Ahour then set_ach
	
	sound 6,(120,10)
	
alarm_set:
	let pins = %00000001
	sertxd ("alarm: ",#Ahour,44,#Amin,13,10)
	if pin2 = 1 then gosub addalarm
	if pin0 = 0 then alarm_set
	goto writedata

addalarm:
	let Amin = Amin + 1
	pulsout 1,10
	pause 250
	if Amin = 60 then gosub addAhour
	return
	
addAhour:
	let Amin = 0
	pulsout 3,10
	let Ahour = Ahour + 1
	pulsout 2,10
	if Ahour = 24 then gosub set_A0
	return
	
set_A0:
	let Ahour = 0
	pulsout 4,10
	return
	
writedata:
	hi2cout [%10100000],1,(Amin)
	pause 20
	hi2cout [%10100000],2,(Ahour)
	pause 20
	let temp_m = 0
	let temp_h = 0
	goto main
	
	
'***Check for alarm activation***

check_alarm:
	if mins = snoozetime then goto soundalarm
	hi2cin [%10100000],1,(Amin)
	hi2cin [%10100000],2,(Ahour)
	if mins = b18 then main
	if Ahour <> hour then main
	if Amin <> mins then main
	

soundalarm:
	if pin0 = 1 then snooze
	let pins = %00000000
	sound 6,(115,10)
	let pins = %00000001
	sound 6,(120,10)
	if pin6 = 0 then setb18
	goto soundalarm


snooze:
	let b18 = mins
	sertxd ("Get Up",13,10)
	let snoozetime = Amin + 5
	pause 500
	goto main

setb18:
	let b18 = 0
	goto main
	

'**********************
'******ALL GOSUBS******
'**********************



'***************************
'***Chanck BCD to decimal***
'***************************

bcd_decimal:
	let temp_byte = sec & %11110000 / 16 * 10
	let sec = sec & %00001111 + temp_byte
	let temp_byte = mins & %11110000 / 16 * 10
	let mins = mins & %00001111 + temp_byte
	let temp_byte = hour & %11110000 / 16 * 10
	let hour = hour & %00001111 + temp_byte

	let temp_byte = day & %11110000 / 16 * 10
	let day = day & %00001111 + temp_byte
	let temp_byte = date & %11110000 / 16 * 10
	let date = date & %00001111 + temp_byte
	let temp_byte = month & %11110000 / 16 * 10
	let month = month & %00001111 + temp_byte
	let temp_byte = year & %11110000 / 16 * 10
	let year = year & %00001111 + temp_byte
	return

'*******************************
'***Set clock from user unput***
'*******************************

set_clock:
	let b13 = 0
	'Convert user input to BCD
	b13 = mins / 10 * 16
	b13 = mins // 10 | b13
	let mins = b13
	let b13 = 0

	b13 = hour / 10 * 16
	b13 = hour // 10 | b13
	let hour = b13
	let b13 = 0
	
	
	
	'set all other data to 00
	let sec = $00
	let day = $00
	let date = $00
	let month = $00
	let year = $00
	let control = %00010000
	
	'Write data to RTC
	hi2cout 0,(sec,mins,hour,day,date,month,year,control)
	pause 20
	sound 6,(120,10)
	goto init


'***Set eeprom data***

Aminsset:
	let Amin = 0
	return
	
Ahourset:
	let Ahour = 0
	return
________
FG FALCON
 
Last edited:

craig008

New Member
just done some more work to it, went simplyfy it to display the time and ran this programme

Code:
symbol control = b0
symbol temp_byte = b1
symbol temp_m = b2
symbol temp_h = b3
symbol sec = b4
symbol mins = b5
symbol hour = b6
symbol day = b7
symbol date = b8
symbol month = b9
symbol year = b10
'b11-b13 used for some switch counts
symbol Amin = b14
symbol Ahour = b15
symbol snoozetime = b16


init:
	hi2csetup i2cmaster, %11010000, i2cslow, i2cbyte
	hi2cin 0,(sec,mins,hour,day,date,month,year,control)
	sertxd (#sec,#mins,#hour,#day,#date,#month,#year,#control,13,10)	'send data to computer
	if control = %00010000 then main						'check RTC to see if has data
'if the RTC has no data then write new values
	let sec = $00 
	let mins = $00
	let hour = $00 
	let day = $00
	let date = $00
	let month = $00
	let year = $00
	let control = %00010000	'set LED to flash
	sertxd (#sec,#mins,#hour,#day,#date,#month,#year,#control,13,10)	'send data to computer
	hi2cout 0,(sec,mins,hour,day,date,month,year,control)			'wrtie RTC
	pause 20
	
'********************
'***Main Programme***
'********************

main:
	let pins = %00000001								'Switch on display
	hi2cin [%11010000],0,(sec,mins,hour,day,date,month,year)		'read RTC
	pause 20
	gosub bcd_decimal									'convert data to readible info
	if temp_m <> mins then set_min						'check mins display
	if temp_h <> hour then set_h							'check hour display
	sertxd ("Time: ",#hour,44,#mins,44,#sec,13,10)				'send time to computer	if pin1 =1 and pin6 = 1 then set_alarm
	'if pin6 = 1 and pin1 = 1 then set_alarm
	'if pin1 = 1 then goto count_t
	'if pin6 = 1 then check_alarm							'check for time set
	goto main
	

'**************
'***Set Mins***
'**************

set_min:
	let b11 = 0
	let pins = %00000000								'Switch off display
	let temp_m = mins
	pulsout 3,10									'reset mins display
	
		set_cm:
			if b11 = mins then main						'check varible to ensure no over flow on display
			let b11 = b11 + 1
			pulsout 1,10							'increse mins display by 1
			if b11 < mins then set_cm
	goto main
	
'***************
'***Set hours***
'***************

set_h:
	let b12 = 0
	let pins = %00000000								'Switch off display
	let temp_h = hour
	pulsout 4,10									'reset hour display
	
		set_ch:
			if b12 = hour then main						'check varible to ensure no over flow on display
			let b12 = b12 + 1
			pulsout 2,10							'increse hour display by 1
			if b12 < hour then set_ch
	goto main
	
	


'***************************
'***Chanck BCD to Decimal***
'***************************

bcd_decimal:
	let temp_byte = sec & %11110000 / 16 * 10
	let sec = sec & %00001111 + temp_byte
	let temp_byte = mins & %11110000 / 16 * 10
	let mins = mins & %00001111 + temp_byte
	let temp_byte = hour & %11110000 / 16 * 10
	let hour = hour & %00001111 + temp_byte

	let temp_byte = day & %11110000 / 16 * 10
	let day = day & %00001111 + temp_byte
	let temp_byte = date & %11110000 / 16 * 10
	let date = date & %00001111 + temp_byte
	let temp_byte = month & %11110000 / 16 * 10
	let month = month & %00001111 + temp_byte
	let temp_byte = year & %11110000 / 16 * 10
	let year = year & %00001111 + temp_byte
	return
this seems to run fine on the simulator but not on the 28x1. it shows 65 on the minutes display at intermitant times, varying from a minutes to a few seconds. all the variables show 165 in all of them. it seems kinda of odd
________
Ford motor company assembly plant
 
Last edited:
Top