Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Categories > Micro Controllers


Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc.

Reply
 
Thread Tools Display Modes
Old 12th May 2008, 02:18 PM   (permalink)
Experienced Member
 
jeremygaughan is on a distinguished road
Default

I should have put some notes out to the side of the program. When I fix it later I'll write a lot of side notes. Here's my logic
transmitter:
Do ADC. Send a fixed IR signal followed by a minimum gap for whenever you send a value close to zero. (if not the IR receiver will turn up the gain and stop receiving)
wait an amount of time based on the ADC, then send another IRpulse to tell the receiver to stop counting.

receiver:
listen for the IR receptor to drive the pin low, wait for pin to be high again and start counting. First count the minimum gap time, then start counting the value to be used in the main program. When the pin is driven low again stop counting. Do PWM.

So I hope that helps this to be clearer. Now I'm doing two channels...send a pulse then data1 then a pulse then data2 then a pulse.....but now I need some kind of really long pulse to lead the data to let the receiver know to start counting data1 then data2.
__________________
jeremy
jeremygaughan is offline   Reply With Quote
Old 15th May 2008, 04:03 AM   (permalink)
Experienced Member
 
Blog Entries: 1
Gayan Soyza is a glorious beacon of lightGayan Soyza is a glorious beacon of lightGayan Soyza is a glorious beacon of lightGayan Soyza is a glorious beacon of lightGayan Soyza is a glorious beacon of light
Default

Hi jeremy are you with me?

Yes I think you are with me.I have written a code for you specially the transmitter part.But I haven't checked it yet.

I'm sending a data packet through IR LED.Don't know whether you like it or not but I have to do.Just go through it.

Code:
GP0=button (active low)
GP1=IR TX LED

;*************************************
;Che_But - sends one packet at a time
;*************************************

Che_But	btfss	GPIO,GP0	;has the button pressed?
	goto	$+2		;yes,
	goto	Che_But		;no,then wait until press
	call	Transmit	;transmit the packet
	btfss	GPIO,GP0	;button still pressed?
	goto	$-1		;yes,
	goto	Che_But		;no,has released,

;********************************************************
;Transmit - routine sends data in the packet (brightness)
;********************************************************

Transmit
	call	Check_AD
	movlw	.8
	movwf	Counter		;makes counter for 8 bit
Loop3	bcf	STATUS,C
	rlf	Brightness,F
	btfss	STATUS,C
	goto	Do_Zero
	goto	Do_Ones

Do_Ones	movlw	d'22'
	movwf	Highpulse	;makes 600uS high time
	goto	$+3
Do_Zero	movlw	d'12'		;makes 300 + low time
	movwf	Highpulse
	call	Do_Logic	;transfer the logic
	call	Do_Gap		;transfer fix gap time
	decfsz	Counter,F	;repeat for other bits
	goto	Loop3
	return

;**************************************
;Check_AD returns the brightness value
;**************************************

Check_AD
	bsf	ADCON0,GO
	btfsc	ADCON0,GO
	goto	$-1
	movf	ADRESH,W
	movwf	Brightness	;brightness contains dim level
	return

;********************************************
;Do_Logic - logic high time > logic low time
;********************************************

Do_Logic
Loop1	BSF	GPIO,1		;27 commands makes 38khz
	goto	$+1
	goto	$+1
	goto	$+1
	goto	$+1
	goto	$+1
	goto	$+1
	BCF	GPIO,1
	goto	$+1
	goto	$+1
	goto	$+1
	goto	$+1
	goto	$+1
	decfsz	Highpulse,F
	goto	Loop1
	return

;*****************************************
;Do_Gap - a fix gap time min 300us needed
;*****************************************

Do_Gap
	movlw	D'12'		;makes a fix gap after burst = 300uS
	movwf	Lowpulse		
Loop2	nop			;27 commands makes 38khz
	goto	$+1
	goto	$+1
	goto	$+1
	goto	$+1
	goto	$+1
	goto	$+1
	nop
	goto	$+1
	goto	$+1
	goto	$+1
	goto	$+1
	goto	$+1
	decfsz	Lowpulse,F
	goto	Loop2
	return
__________________
Gayan
Forum Supporter
Gayan Soyza is online now   Reply With Quote
Old 15th May 2008, 05:20 AM   (permalink)
Experienced Member
 
jeremygaughan is on a distinguished road
Default

very nice. I like the roll folder left to transmit exactly the value you want. Looks like a good way to get a precise number. I'm just counting the gap, whereas you are sending the 8 bit number one bit at a time. One thing I see is that you need to send a unique pulse before the whole thing so the receiver knows that it's the beginning of the packet being sent. I see that you have the button so that it only sends one packet at a time, but if it catches it in the middle or gets the first bit of interference from a light in the house it will be out of sequence. I'm crazy busy at work lately, but I'm going to build your code and try it when I get a moment. Also, I've almost got my two channel code going. Big long IR pulse to mark the start of the packet then gap, small pulse, gap, small pulse. Then I'm going to use a lightened micro servo to turn it. Soon I'll have control of this foam, pager motor pulling, scotch tape, toothpick braced junker.
__________________
jeremy
jeremygaughan is offline   Reply With Quote
Old 15th May 2008, 05:33 AM   (permalink)
Experienced Member
 
Blog Entries: 1
Gayan Soyza is a glorious beacon of lightGayan Soyza is a glorious beacon of lightGayan Soyza is a glorious beacon of lightGayan Soyza is a glorious beacon of lightGayan Soyza is a glorious beacon of light
Default

Quote:
Originally Posted by jeremygaughan
but I'm going to build your code and try it when I get a moment. Also, I've almost got my two channel code going. Big long IR pulse to mark the start of the packet then gap, small pulse, gap, small pulse.
Oh you have stolen my packet transferring codes

A similar technic that I used in my IR projects.Thats a clever technic.So you no need to worry about the resolution or time takes to transfer.

8 bit resolution is more than enouth to dim a LED smoothly or to speed control a DC motor.
__________________
Gayan
Forum Supporter
Gayan Soyza is online now   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Latest
where to buy test equipment notwist General Electronics Chat 5 30th March 2008 09:37 PM
Test Equipment abbarue General Electronics Chat 3 10th November 2007 04:59 AM
Good Electronic Supply's Sites, Everyone Come On In! :P Electric Rain General Electronics Chat 44 27th August 2007 11:05 PM
more test equipment! HiTech Chit-Chat 5 15th September 2006 05:41 PM
High speed switch in psu..I have better test equipment now heathtech General Electronics Chat 26 11th July 2005 05:15 PM



All times are GMT. The time now is 10:37 AM.


Electronic Circuits  |  Radio Controlled
Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.