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.

1 sec pulse from 30 sec clock

Status
Not open for further replies.
Mike

I think that so long as the slave gets like you say a -

pulse length of 0.5 sec at +24v and 0v and then a pulse length of 0.5 sec at 0v and +24v

It should work fine but I will ask around to make sure!!!

Regards Mark
 
Last edited:
Mike
I have been blowing my brain with this all day and I want to put a thought in and see if I get a reply on if I'm right with my suggestion on how the slave could work.

As I see it the confusion is with the required pulse length of the slave being approx 0.7's long

Well I think this is possible and I will try and explain why (pray)

The pendulum passes the bottom every second so two passes of bottom centre is 2 seconds !!!

If the contact for the changeover relay is centre bottom then the relay gets a pulse 1 x every second so the power flow could go something like this (pray again)

(1st sec pulse) +24v and 0v
(2nd sec pulse) 0v and +24v

And so the flow would go :


+24v and 0v ---> +24v and 0v ---> +24v and 0v---> +24v and 0v and so on!!

+24v 0v +24v 0v +24v 0v +24v 0v +24v 0v giving us the alternating polarity every sec.

because the timing of the pulses are 1 second periods the length of the pulse time to the slave can be 0.7 as it does not exceed the 1 sec duration it takes to get to the next pulse.

Because the changeover relay has normally open and normally closed contacts the alternating sequence is started.

I think that is it but I am asking around from some that my put a spanner in the works.

Sorry for my confusion but you are right to ask otherwise this would be wrong.
I welcome any comments on the theory I have put forward ,if it sound wrong please let me know.

Mike should I go ahead with the parts purchase from Farnels anyway???

I do really appreciate this effort you and others put into it and I'm sure it won't be long before any doubts are all cleared up.

Kind regards mark
 
Last edited:
It sounds like the best thing to do is to order the parts and build a prototype.

I suggest that you initially use the 12V supply from the master to power the H bridge (SN754410) and to feed the 78L05 for the pic supply.

Once the hardware is available it will be fairly easy to change the code to accommodate different timing requirements.

BTW, if you don't get an immediate reply it's probably because I'm in bed. Being 10 hours ahead of the UK makes communication difficult.

Mike.
 
Pommie said:
It sounds like the best thing to do is to order the parts and build a prototype.

I suggest that you initially use the 12V supply from the master to power the H bridge (SN754410) and to feed the 78L05 for the pic supply.

Once the hardware is available it will be fairly easy to change the code to accommodate different timing requirements.

BTW, if you don't get an immediate reply it's probably because I'm in bed. Being 10 hours ahead of the UK makes communication difficult.

Mike.

Mike

I will experimant on the slave also just to see if it will work from each 1 sec swing of the pendulum but I'm sure that what I outlind above is correct.

I even thought of using a modified quartz clock, these are also bipolar and require a pulse length of around 300ms at 1.5v just a thought for another day.

Ok with that, Farnel's it is!!!!

I understand about the distance but don't worry I might be closer one day.My Aunt is moving to Ausi next week and I wish I were following her:D

I will give the nod when the parts arrive.

Kind regards

Mark
 
Mike

Just a couple of questions to help me understand the circuit and whats going on.

The 'H-bridge' do we use this because of the required 12v of the slave, just a thought as the pic can deal with low voltage levels without the H-bridge.For example would I require the H-bridge if I were to use a 1.5v quartz movement as the slave?

The 'Watch Crystal' what is the purpose of this? I would assume that is give the pic a time base to work from but why 32768Hz what is segnificant adout this Hz? why not a 4.194.304 MHz ?

Just a couple of questions to help me understand what is happening.

Regards Mark
 
Mark,

The H bridge serves two purposes, to convert from logic levels (5V) to solenoid levels (12/24V) and to enable higher currents to be supplied. The H bridge could in fact be replaced by a relay that was configured for changeover. You could drive a 1.5V clock direct from the pic as long as the current requirement is no greater than 20mA.

The watch crystal is to run the pic. The reason that clock crystals are either 32,768Hz or 4,194,304Hz is because these are nice round numbers in binary and so easy to divide down in hardware.
32768 = 1,000,000,000,000,000 binary = 2^15
4194304 = 10,000,000,000,000,000,000,000 binary = 2^22
Either would be suitable for your project. The reason I chose 32768 was because the internal timers in the pic are 16 bit which will accommodate 2^15 but not 2^22. Also, slower running circuits use less power and are more stable.

One reason I suggested changing to a 16F88 was because it has an internal clock that can run at 32768Hz (the 628 runs at 4MHz but could still be used.). Unfortunately, these internal clocks are only accurate to 1%. In ppm terms that’s 10,000ppm compared to a crystals 20ppm. However, because we have a signal that arrives every 30 seconds, we can use it to calculate the true speed of the internal clock and compensate in software. This would mean that the first 30 second period would have seconds that could vary by ± 10mS, but subsequent seconds would be accurate.

Where about in Aus is your Aunt moving to? I only moved here 4 years ago from Manchester. Needless to say, I’m not missing the weather. I'm also rather surprised at how bad Maplins has become! It now looks more like Tandy.

Mike.
 
Pommie said:
Mark,

The H bridge serves two purposes, to convert from logic levels (5V) to solenoid levels (12/24V) and to enable higher currents to be supplied. The H bridge could in fact be replaced by a relay that was configured for changeover. You could drive a 1.5V clock direct from the pic as long as the current requirement is no greater than 20mA.

The watch crystal is to run the pic. The reason that clock crystals are either 32,768Hz or 4,194,304Hz is because these are nice round numbers in binary and so easy to divide down in hardware.
32768 = 1,000,000,000,000,000 binary = 2^15
4194304 = 10,000,000,000,000,000,000,000 binary = 2^22
Either would be suitable for your project. The reason I chose 32768 was because the internal timers in the pic are 16 bit which will accommodate 2^15 but not 2^22. Also, slower running circuits use less power and are more stable.

One reason I suggested changing to a 16F88 was because it has an internal clock that can run at 32768Hz (the 628 runs at 4MHz but could still be used.). Unfortunately, these internal clocks are only accurate to 1%. In ppm terms that’s 10,000ppm compared to a crystals 20ppm. However, because we have a signal that arrives every 30 seconds, we can use it to calculate the true speed of the internal clock and compensate in software. This would mean that the first 30 second period would have seconds that could vary by ± 10mS, but subsequent seconds would be accurate.

Where about in Aus is your Aunt moving to? I only moved here 4 years ago from Manchester. Needless to say, I’m not missing the weather. I'm also rather surprised at how bad Maplins has become! It now looks more like Tandy.

Mike.


Mike

Cheers for the detailed reply.

As you can understand while in the process of getting my head around PIC. programming a very important aspect is understanding what is going on with the hardware so we can make changes if required in the software. Good thing about PIC's are their versatility being able to do away with many components.

This will now make the construction of this project much easier to
understand

I have ordered both pics from Farnell's anyway so when we get to build and flashing stages I will take your advice and do what's best for this project.


Dunt quite know where my Aunt is going But I will find out.

I often keep thinking of going to Ausi myself, trouble is it's quite hard these days to get over there. I don't have much to offer in the way of qualification and skills.
NVQ Level 3 Carpentry and Joinery
D32 NVQ assessor
First Aid at work
Fire safety / fire prevention officer at work

I filled in an online application on a skills basis but it would not let me complete because my Wife has no job, only house wife and Mother but this did not count.

I have approx £70.000 equity in my home so I don't know if this would help.
Anyway could be just a pipe dream!!

As you may have seen on the TV. the weather in the UK as been mad!!! flash floods all over the place. Manchester I think escaped anything bad.


Anyway guday

Kind regards Mark
 
Mike

My Aunt is going to Adelaide,Wish I were going with her too:D

Maplins is a big concern over hear,they have big superstores that you can walk around I tend to try and go without the Wife as she get very bored with it.

Fannells have come up trumps with a good prompt delivery, I received thee parts this morning.

What I did forget is Breadboards, I want to get it right on these then maybe just maybe I will try my hand at PCB. as got to get the circuit small.

Could I be so bold as to ask if you could include a complete schema :eek: one with the 5v supply and the resistor and capacitor values included. Sorry for asking I just want to get it right.

Kind regards Mark
 
markelectro said:
Mike

My Aunt is going to Adelaide,Wish I were going with her too:D

Maplins is a big concern over here,they have big superstores that you can walk around I tend to try and go without the Wife as she gets very bored with it.

Fannell's have come up trumps with a good prompt delivery, I received the parts this morning.

What I did forget is Breadboards, I want to get it right on these then maybe just maybe I will try my hand at PCB. as got to get the circuit small.I will get these from Maplins.

Could I be so bold as to ask if you could include a complete schema :eek: one with the 5v supply and the resistor and capacitor values included. Sorry for asking I just want to get it right.

Kind regards Mark


Mike when you find the time of course.

Regards Mark
 
Last edited:
Mark,

No problem.

In the attached diagram the resistors can all be 10K.

I think your Aunt will like Adelaide. My daughter is currently doing a double maths :eek: degree at Adelaide University.

Mike.
 
Last edited:
Mike

Just to let you know that I have not given up with the project it's just that I am now back at work after a two week break.Time will be a little harder to find as less time for myself.I should hopefully have started if not finished by or during next weekend.

Good leaving do on sat,got quite drunk she will be heading your way to Adelaide on the 20th I was hoping she could fit me in the case.:D

Regards Mark
 
Mike :eek:

Seems that I'm failing at the first hurdle :eek:

I sat down having found sometime to start and write the asm. code into my asm. editor I use a program that was designed by Peter Brunning-
https://brunningsoftware.co.uk/

I would have thought that your programme would go right into my asm.editor but it seems that this is not so.When entering your asm. code very early on I get error beeps to indicate that the code was not recognised within the Brunning software to Create a code.:mad: tus meaning that somthing is differant.

Do you microchips assembler to write your codes? Maybe it will be best to download this? but again I will have to get my head around that before writting :eek: !!??

What is your advice?

I will endeavour to get to the bottom of this and let you know when I have got over the assembler problems.

Mark
 
Pommie said:
Here's a first go at an asm file. It uses timer1 and the ccp module to generate an interrupt every 0.5 seconds and the RB0 interrupt to reset the timer. It is untested as I don't have a 628 handy at the moment but I think it should work.

On the circuit diagram, I would add a 5k resistor from RB3 to ground.
This code assumes a crystal frequency of 32768Hz. If you can only get 38k crystals then change the 0x4000 to d'19000'.

Mike.

Code:
;*******************************************************************
;                           16F628 Timer Program
;*******************************************************************
;

	list      p=16f628A           ; list directive to define processor
	#include <p16F628A.inc>       ; processor specific variable definitions

	errorlevel  -302              ; suppress message 302 from list file

	__CONFIG   _CP_OFF & _DATA_CP_OFF & _LVP_OFF & _BOREN_OFF & _MCLRE_ON & _WDT_OFF & _PWRTE_ON & _LP_OSC


		cblock	20h
Phase

		endc


		cblock	70h
int_work
int_status
int_pclath
int_fsr
		endc



		org     0h
		goto    start
		nop
		nop
		nop

interupt	movwf	int_work
		swapf	STATUS,W
		movwf	int_status
		bcf	STATUS,RP0
		bcf	STATUS,RP1
		movfw	PCLATH
		movwf	int_pclath
		clrf	PCLATH
		movfw	FSR
		movwf	int_fsr

		btfss	INTCON,INTF	;has RB0 gone high
		goto	NotRB0		; no

; yes, clear the timer and phase 
		bcf	INTCON,INTF
		clrf	TMR1L
		clrf	TMR1H
		clrf	Phase

NotRB0		btfss	PIR1,CCP1IF
		goto	NotCCP1

;time up so toggle port b outputs.

		bcf	PIR1,CCP1IF;	reset special event trigger interupt
		movlw	b'00001100';	make rb1 low and rb2 high
		btfss	Phase,0
		movlw	b'00001010';	make rb1 high and rb2 low
		movwf	PORTB
		incf	Phase,F	;	will toggle bit 0 of phase
NotCCP1
		movfw	int_pclath
		movwf	PCLATH
		movfw	int_fsr
		movwf	FSR
		swapf	int_status,W
		movwf	STATUS
		swapf	int_work,F;	swap to file
		swapf	int_work,W;	swap to work
		retfie


start		bsf	STATUS,RP0
		bcf	STATUS,RP1
		bcf	STATUS,IRP
		movlw	b'01000000';	interrupt on rising edge
		movwf	OPTION_REG
		movlw	b'11111111'
		movwf	TRISA
		movlw	b'11110001';	make rb1,2,3 output
		movwf	TRISB

		clrf	PORTA
		clrf	PORTB

		movlw	b'00000111';	setup comparator
		movwf	CMCON

		movlw	B'00000001'
		movwf	T1CON;		enable timer 1

		movlw	low(0x4000);	0x4000 = half of 32768 i.e. 0.5 seconds
		movwf	CCPR1L
		movlw	high(0x4000)
		movwf	CCPR1H
		movlw	B'00001011';	enable special event trigger on CCP1
		movwf	CCP1CON;	

		bsf	STATUS,RP0
		bsf	PIE1,CCP1IE;	enable CCP1 interupt
		bcf	STATUS,RP0

		movlw	(1<<GIE|1<<PEIE|0<<T0IE|1<<INTE|0<<RBIE|0<<T0IF|0<<INTF|0<<RBIF)
		movwf	INTCON;		enable Peripheral and RB0 interrupts


Loop		goto	Loop


		end








Mike

Just looking at your code.Is every line in the file where it should be? with my lack of knowledge I may be retuning/entering to a new line where I shouldn't be!!
It could be that when the file was saved and then uploaded it moved some parts of the file down.

Mark
 
Mark,

You need to install MPLAB. You can download it free from Microchip. Once you have it installed you need to start a new project and add a .asm file, then cut and paste the code above into the asm file.

Mike.
 
Mike

Just to say that I've defo not given up but sorry not been in touch before now. I did download the mplab but I have to confess this is not like my tutorial that I purchased. Peter brunning the creator as made his programmer ans software dedicated to each other.I had a complete brain meltdown and decided that I have to find a mplab walk through (an idiots guide) when I find a suitable one and a new programmer I will start again.


Regards Mark
 
I always believe in the KISS principle ( Keep It Simple Stupid )

If you can avoid complicated programming with exotic IC's or dodgy software go the other way.

Use some discrete logic or electromechanical means, which is part of a clock building hobby anyway go that route.

I make some pics of the tacho I built from old Landis & Gyr clock parts and a transisitor push pull driver.
My system has been working for 2 years continuously now, with no faillures.
Also during a power cut the seconds will get synchronised back in step.

Regards

Raymond
 
Hello Ray

I like your thoughts !!! would like to see anything you have to show that would help.

BTW. I purchased a new clcok this week from Ebay.Was made up of old gop. parts but with a very interesting dial. I have added some photos to my website-

**broken link removed**

high/low tide and moon phases.The case wants some work but otherwise ok.


Regards Mark



RODALCO said:
I always believe in the KISS principle ( Keep It Simple Stupid )

If you can avoid complicated programming with exotic IC's or dodgy software go the other way.

Use some discrete logic or electromechanical means, which is part of a clock building hobby anyway go that route.

I make some pics of the tacho I built from old Landis & Gyr clock parts and a transisitor push pull driver.
My system has been working for 2 years continuously now, with no faillures.
Also during a power cut the seconds will get synchronised back in step.

Regards

Raymond
 
Interesting clock you got there. Hope the price was ok.

Attached are 2 pics from the tachodrive i build,

Unfortunately you can't see the gears, because the driverboard is mounted on top of it.
Basically it is a synchronous motor which drives a geartrain and generates 60 impulses via one of the the discs in 58.6 seconds.
Then it stops to be released via a 24 volts relay from the master clock via a change over switch.
The opto's are from a ferraris induction meter which have IR leds at a 45° angle and scan the black marks.
These drive the push pull driver and give me ± 2 Ampères at 24 volts to drive the slave clocks.
The other disc drives a slave clock at a 2.5 seconds interval which has a so called "Suchzeiger" searchdial. It's ex Bundesbahn, German Railways.

In the drive i changed a gear ratio from 50 / 50 to 44 / 45, which is easy to accomplish with old L&G meter parts which are made like little Meccano gears.

If you work along a similar principle where a synch motor drives a geartrain or marked wheel and generate 30 impulses in just under 30 seconds. Your masterclock will keep the tacho in step.

Regards
Raymond
 

Attachments

  • DSC00643a.JPG
    DSC00643a.JPG
    91.8 KB · Views: 198
  • DSC00644a.JPG
    DSC00644a.JPG
    94.8 KB · Views: 176
Status
Not open for further replies.

Latest threads

Back
Top