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
 
LinkBack Thread Tools Display Modes
Old 13th April 2008, 06:51 PM   #16 (permalink)
New Member
 
Join Date: Apr 2008
Location: US
Posts: 21
engineergirl27 is on a distinguished road
Default

I know, this programming for me, has brought me many questions and solutions, and i think that is why I am having so many problems, I don't know which solutions is best. Yes to the nearest Degree is fine, same with the nearest 1%, I also, have a push button that is going to be pressed to show the heat index or wind chill. And i was thinking about .5 seconds or so to be refreshed
engineergirl27 is offline   Reply With Quote
Old 13th April 2008, 06:54 PM   #17 (permalink)
New Member
 
Join Date: Apr 2008
Location: US
Posts: 21
engineergirl27 is on a distinguished road
Default

May 9th, I would like to get it done before that of course to get it tested. that is right the temp is in mV and the humidty is a frequency, it is difficult to keep them straight since I am not setting them up.
engineergirl27 is offline   Reply With Quote
Old 13th April 2008, 07:29 PM   #18 (permalink)
New Member
 
Join Date: Apr 2008
Location: US
Posts: 21
engineergirl27 is on a distinguished road
Default

Eric,
I know, this programming for me, has brought me many questions and solutions, and i think that is why I am having so many problems, I don't know which solutions is best. Yes to the nearest Degree is fine, same with the nearest 1%, I also, have a push button that is going to be pressed to show the heat index or wind chill. And i was thinking about .5 seconds or so to be refreshed

blue,
May 9th, I would like to get it done before that of course to get it tested. that is right the temp is in mV and the humidty is a frequency, it is difficult to keep them straight since I am not setting them up.
engineergirl27 is offline   Reply With Quote
Old 14th April 2008, 07:22 AM   #19 (permalink)
Experienced Member
 
 
Join Date: Jan 2007
Location: U.K.
Posts: 3,778
ericgibbs is a splendid one to beholdericgibbs is a splendid one to beholdericgibbs is a splendid one to beholdericgibbs is a splendid one to beholdericgibbs is a splendid one to beholdericgibbs is a splendid one to beholdericgibbs is a splendid one to behold
Default

Quote:
Originally Posted by engineergirl27
Eric,
I know, this programming for me, has brought me many questions and solutions, and i think that is why I am having so many problems, I don't know which solutions is best. Yes to the nearest Degree is fine, same with the nearest 1%, I also, have a push button that is going to be pressed to show the heat index or wind chill. And i was thinking about .5 seconds or so to be refreshed
Hi,
Understood.

I would recommend the follow bits of test hardware in order to simulate the inputs from the various sensors.

1. A 5K0 multiturn pot, connected from +5V to 0V with the wiper going to the PIC's AN0 input, together with a DVM capable of measuring mV, for simulating the LM335 temperature sensor.

2. A variable rate square wave pulse generator, with a setting read out, to simulate the HS1101 humidity 555 osc output.

3. A 8 bit DIL switch to simulate the Wind speed input.

You say you are using 4 off, 7seg LED's,,, these will require a few extra components because of the multiplexing of
the PIC port pins required to drive them.

I would advise, that you write the program in a modular way, that is write the sub programs for each module before you integrate them in your final program.

Thats a module for each of the three sensors, the LED display, switch inputs and the maths subroutines.

I would start with the display drivers module.
This then can be used to display the outputs of the various modules as you develop them.

You say 8/9th May 2008 is the deadline, I think an experienced programmer would find it difficult to complete, fully test and debug the hardware/software in 3 weeks for this project.

Can you say which country you are posting from.?
__________________
Eric
"Good enough is Perfect"

PIC tutorials:
Nigel's site: http://www.winpicprog.co.uk/
Gramo's site: http://www.digital-diy.net/
ericgibbs is online now   Reply With Quote
Old 14th April 2008, 02:02 PM   #20 (permalink)
New Member
 
Join Date: Apr 2008
Location: US
Posts: 21
engineergirl27 is on a distinguished road
Default

Quote:
Originally Posted by ericgibbs
Hi,
Understood.

I would recommend the follow bits of test hardware in order to simulate the inputs from the various sensors.

1. A 5K0 multiturn pot, connected from +5V to 0V with the wiper going to the PIC's AN0 input, together with a DVM capable of measuring mV, for simulating the LM335 temperature sensor.

2. A variable rate square wave pulse generator, with a setting read out, to simulate the HS1101 humidity 555 osc output.

3. A 8 bit DIL switch to simulate the Wind speed input.

You say you are using 4 off, 7seg LED's,,, these will require a few extra components because of the multiplexing of
the PIC port pins required to drive them.

I would advise, that you write the program in a modular way, that is write the sub programs for each module before you integrate them in your final program.

Thats a module for each of the three sensors, the LED display, switch inputs and the maths subroutines.

I would start with the display drivers module.
This then can be used to display the outputs of the various modules as you develop them.

You say 8/9th May 2008 is the deadline, I think an experienced programmer would find it difficult to complete, fully test and debug the hardware/software in 3 weeks for this project.
There are other students working on the other parts of this most of which already work. Someone else is already doing all the extra hardware for the 7 segments, Also, I have all those testing already, and the AtoD and the 8 bit binary code works, I just need to know how to integrate them, which I am going to my professor for help now.


Can you say which country you are posting from.?
I am posting from the US

Elizabeth
engineergirl27 is offline   Reply With Quote
Old 14th April 2008, 02:32 PM   #21 (permalink)
Experienced Member
 
 
Join Date: Jan 2007
Location: U.K.
Posts: 3,778
ericgibbs is a splendid one to beholdericgibbs is a splendid one to beholdericgibbs is a splendid one to beholdericgibbs is a splendid one to beholdericgibbs is a splendid one to beholdericgibbs is a splendid one to beholdericgibbs is a splendid one to behold
Default

hi Elizabeth,
The reason for asking your location is because it seems when I am close to closing down you are starting up..

These are asm tutorials from Nigel Goodwins site.

http://www.winpicprog.co.uk/

Specific to your project are the 7seg LED mux and Analog tutorials.

http://www.winpicprog.co.uk/pic_tutorial10.htm

http://www.winpicprog.co.uk/pic_tutorial11.htm

This one for switches.
http://www.winpicprog.co.uk/pic_tutorial2.htm

You could easily adapt these to suit the project.

IIRC 'Bill' of Blueroom electronics has done some programming for the HS1101 sensor.?

Why dont you write up a program for the LED's and post it, then we can work thru it with you. Likewise the analog module.

I hope you are finding these posts helpful, if not ask specific questions.
__________________
Eric
"Good enough is Perfect"

PIC tutorials:
Nigel's site: http://www.winpicprog.co.uk/
Gramo's site: http://www.digital-diy.net/
ericgibbs is online now   Reply With Quote
Old 14th April 2008, 03:59 PM   #22 (permalink)
Experienced Member
 
 
Join Date: Jan 2007
Location: Toronto, Canada
Posts: 4,121
blueroomelectronics is a splendid one to beholdblueroomelectronics is a splendid one to beholdblueroomelectronics is a splendid one to beholdblueroomelectronics is a splendid one to beholdblueroomelectronics is a splendid one to beholdblueroomelectronics is a splendid one to behold
Send a message via Skype™ to blueroomelectronics
Default

Hardware yes with the HS1101, software very basic but I cheated Insteaded of a frequency counter it was simple to connect a spare I/O pin to the 7555 reset pin and the output to one of the CCP inputs. Easy.

I agree, as a first PIC project you've got quite an effort ahead of you to complete it by May 9.
__________________
Bill
Smart Kits build Smart People

http://www.blueroomelectronics.com
blueroomelectronics is online now   Reply With Quote
Old 14th April 2008, 04:03 PM   #23 (permalink)
New Member
 
Join Date: Apr 2008
Location: US
Posts: 21
engineergirl27 is on a distinguished road
Default

Thank you, those will help. I am just getting frustrated with myself, because this all seems so new to me. I have had the semester to work on it, but we have also had to do tons of business work for marketing the product, and everything else. We don't get enough training with the programming, at school, we need to teach ourselves.

So thanks, I will be back with more specific questions if I have any.

Elizabeth
engineergirl27 is offline   Reply With Quote
Old 15th April 2008, 01:02 PM   #24 (permalink)
Experienced Member
 
 
Join Date: Jan 2007
Location: U.K.
Posts: 3,778
ericgibbs is a splendid one to beholdericgibbs is a splendid one to beholdericgibbs is a splendid one to beholdericgibbs is a splendid one to beholdericgibbs is a splendid one to beholdericgibbs is a splendid one to beholdericgibbs is a splendid one to behold
Default

hi Elizabeth,

This is a link just posted by Bill on another thread, thought it might be useful.

http://www.gooligum.com.au/tutorials.html
__________________
Eric
"Good enough is Perfect"

PIC tutorials:
Nigel's site: http://www.winpicprog.co.uk/
Gramo's site: http://www.digital-diy.net/
ericgibbs is online now   Reply With Quote
Old 22nd April 2008, 04:35 AM   #25 (permalink)
New Member
 
Join Date: Apr 2008
Location: US
Posts: 21
engineergirl27 is on a distinguished road
Default

Hey guys,

So I have more of a program written, It still isn't what it needs to be but i have a specific question, here is the code that i have

include <p16F877a.inc>
LIST p=16F877a
errorlevel 1,-302 ;to disable MPLAB bank warnings.
__config _XT_OSC & _PWRTE_ON & _WDT_OFF &_LVP_OFF
;
;Some versions of MPLAB use _LVP_OFF
;This sets all portB pins to output.
;Variables
cblock 0x20 ;start of general purpose registers
count
endc
;/*---------Init Ports
bsf STATUS,RP0
MOVLW B'00000001'
MOVWF TRISA ;All outputs except RA0.
MOVLW B'00000011'
movwf TRISD
CLRF TRISB ;RA0 is wiper of 50k pot/Vin
movlw b'11111111'
movwf TRISC ;PortB is 8 LED output to show

;/*-----Set up A2D parameters
MOVLW B'00001110' ;Hex value of Vin from pot.
MOVWF ADCON1 ;left justified, RA0 = input
MOVLW B'11010111' ;prescaler 1:256 tmr0, internal clock
MOVWF OPTION_REG
BCF STATUS,RP0

;/*---------Set up chip parameters
Start CALL A2D
MOVWF PORTB ;output Hex value to LEDs



PC clrf count
BTFSS PORTD,0
bsf count,0

BTFSS PORTD,1
bsf count,0

BTFSS count,0
goto Start

movf PORTC,w
movwf PORTB

goto PC


A2D
MOVLW B'01000001' ;a2d = on, ch0, fosc/8
MOVWF ADCON0
;/*-----Delay loop to settle A2D, similar to de-bounce???
mnloop btfss INTCON,T0IF ;50us loop delay @ 4Mhz
goto mnloop
;/*-----Stop timer0 interrupt
BCF INTCON,T0IF
BSF ADCON0,GO_DONE ;start a2d conversion
WAITA2D NOP ;wait 4 finish
BTFSC ADCON0,GO_DONE
GOTO WAITA2D
;/*-----Put A2D/PWM value in W and send to ports.
MOVF ADRESH,W ;upper 8 bits-ignor lower 3


RETURN ;DUTY CYCLE IS 25% OF PWM PERIOD



END

Now I plug in the temperature sensor that is also tied to an amplifier to amplify the voltage, when it goes through this program and displays on the eight LEDs on port B it counts very fast. I tried to change the
MOVF ADRESH,W
to see if it was counting the wrong 8 bits, but it did the same thing.
Any Suggestions?
Also any quick suggestions for help with entering an equation like this into assembly
windchill = 35.74+0.6215T-35.75(V^0.16)+0.4275T(V^0.16)

Elizabeth
engineergirl27 is offline   Reply With Quote
Old 22nd April 2008, 04:49 AM   #26 (permalink)
Experienced Member
 
 
Join Date: Oct 2006
Location: Colombo
Posts: 946
Gayan Soyza is just really niceGayan Soyza is just really niceGayan Soyza is just really nice
Default

Code:
	include <p16F877a.inc>
	LIST p=16F877a
	errorlevel 1,-302 ;to disable MPLAB bank warnings.
	__config _XT_OSC & _PWRTE_ON & _WDT_OFF &_LVP_OFF
;
;Some versions of MPLAB use _LVP_OFF
;This sets all portB pins to output.
;Variables
	cblock 0x20 		;start of general purpose registers
	count
	endc

;/*---------Init Ports

	bsf 	STATUS,RP0
	MOVLW 	B'00000001'
	MOVWF 	TRISA 		;All outputs except RA0.
	MOVLW 	B'00000011'
	movwf 	TRISD
	CLRF 	TRISB 		;RA0 is wiper of 50k pot/Vin
	movlw 	b'11111111'
	movwf 	TRISC 		;PortB is 8 LED output to show

;/*-----Set up A2D parameters

	MOVLW 	B'00001110' 	;Hex value of Vin from pot.
	MOVWF 	ADCON1 		;left justified, RA0 = input
	MOVLW 	B'11010111' 	;prescaler 1:256 tmr0, internal clock
	MOVWF 	OPTION_REG
	BCF 	STATUS,RP0

;/*---------Set up chip parameters

Start 	CALL 	A2D
	MOVWF 	PORTB 		;output Hex value to LEDs



	PC 	clrf count
	BTFSS 	PORTD,0
	bsf 	count,0

	BTFSS 	PORTD,1
	bsf 	count,0

	BTFSS 	count,0
	goto 	Start

	movf 	PORTC,w
	movwf 	PORTB

	goto 	PC


A2D
	MOVLW 	B'01000001' 	;a2d = on, ch0, fosc/8
	MOVWF 	ADCON0

;/*-----Delay 	loop to settle A2D, similar to de-bounce???

mnloop 	btfss 	INTCON,T0IF 	;50us loop delay @ 4Mhz
	goto 	mnloop

;/*-----Stop timer0 interrupt

	BCF 	INTCON,T0IF
	BSF 	ADCON0,GO_DONE 	;start a2d conversion
WAITA2D NOP 			;wait 4 finish
	BTFSC 	ADCON0,GO_DONE
	GOTO 	WAITA2D
;/*-----Put 	A2D/PWM value in W and send to ports.
	MOVF 	ADRESH,W 	;upper 8 bits-ignor lower 3
	RETURN 			;DUTY CYCLE IS 25% OF PWM PERIOD


	END
__________________
Gayan
Forum Supporter
Gayan Soyza is offline   Reply With Quote
Old 22nd April 2008, 05:28 AM   #27 (permalink)
New Member
 
Join Date: Apr 2008
Location: US
Posts: 21
engineergirl27 is on a distinguished road
Default

Blue could you explain a little more what you did with the humidity sensor? And did you used a completely different port than the other inputs. And with the CCP pins, I am currently using the Port C as the input from the windchill. Should I move those?
engineergirl27 is offline   Reply With Quote
Old 29th April 2008, 05:50 PM   #28 (permalink)
New Member
 
Join Date: Apr 2008
Location: US
Posts: 21
engineergirl27 is on a distinguished road
Default

Hey Guys,

I have been programming, and I have quite a bit done, I was wondering if any of you could help with the math. The equations are quite extensive and I am not that familiar with it enough to do these extensive of equations.

Here is what I have got. AND IT WORKS


Code:
        #include <p16F877a.inc>
        LIST p=16F877a
	errorlevel 1,-302	;to disable MPLAB bank warnings.
        __config _XT_OSC & _PWRTE_ON & _WDT_OFF &_LVP_OFF
;
		;Some versions of MPLAB use _LVP_OFF
		;This sets all portB pins to output.
;Variables
 		cblock	0x20			;start of general purpose registers
		COUNT
	    TEMP
		CYC
		endc
;/*---------Init Ports
		bsf     STATUS,RP0
        MOVLW   B'00000001'
		MOVWF   TRISA        ;All outputs except RA0.
		
		MOVLW   B'00000011'
		movwf	TRISE
        CLRF    TRISB			;PortB is 8 LED output to show
		movlw	b'11111111'
        movwf   TRISD	
                    
;/*-----Set up A2D parameters
        MOVLW   B'00001110'     
        MOVWF   ADCON1		
        MOVLW   B'11010111'     
        MOVWF   OPTION_REG
        BCF     STATUS,RP0

;/*---------Set up chip parameters
Start	CALL	A2D
        MOVWF   TEMP
		MOVWF   PORTB		;output Hex value to LEDs

		

PC	
		BTFSC	PORTE,0
		goto    Start
		
        ;TEMP <= 80
	    movf TEMP,w
        addlw d'255'-d'80'          
        skpnc
        Call HeatIndex
        ;TEMP <= 40
        movf TEMP,w
        addlw d'255'-d'40'
        skpc
        Call WindChill
        
        GOTO  Start

A2D     
        MOVLW   B'01000001'     ;a2d = on, ch0, fosc/8
        MOVWF   ADCON0
;/*-----Delay loop to settle A2D, similar to de-bounce???
mnloop  btfss   INTCON,T0IF     ;50us loop delay @ 4Mhz
        goto    mnloop
;/*-----Stop timer0 interrupt
        BCF     INTCON,T0IF
        BSF     ADCON0,GO_DONE  ;start a2d conversion
WAITA2D NOP                     ;wait 4 finish
        BTFSC   ADCON0,GO_DONE
        GOTO    WAITA2D
;/*-----Put A2D W and send to port B.
        MOVF    ADRESH,W        ;upper 8 bits-ignor lower 3
        RETURN

HeatIndex
       
START  MOVLW d'10'
       MOVWF CYC
       
       CLRF  COUNT
L1     BTFSS PORTC,2
       GOTO  L1
       
L2     INCF  COUNT
       BTFSC PORTC,2
       GOTO  L2
       
       DECFSZ CYC
       GOTO  L1
       
       MOVF  COUNT,w
       MOVWF PORTB
       
       
       BTFSS PORTE,0
       
       GOTO  HeatIndex
       
       RETURN
       

WindChill
       	movf	PORTD,w
		movwf	PORTB

        BTFSS PORTE,0
        GOTO  WindChill
		RETURN			
 
	

   END

Last edited by engineergirl27; 30th April 2008 at 05:01 PM.
engineergirl27 is offline   Reply With Quote
Old 30th April 2008, 07:52 AM   #29 (permalink)
Experienced Member
 
 
Join Date: Jan 2007
Location: U.K.
Posts: 3,778
ericgibbs is a splendid one to beholdericgibbs is a splendid one to beholdericgibbs is a splendid one to beholdericgibbs is a splendid one to beholdericgibbs is a splendid one to beholdericgibbs is a splendid one to beholdericgibbs is a splendid one to behold
Default

Quote:
Originally Posted by engineergirl27
Hey Guys,

I have been programming, and I have quite a bit done, I was wondering if any of you could help with the math. The equations are quite extensive and I am not that familiar with it enough to do these extensive of equations.
Hi,
Nice job.

Post the 'equations' in their mathematic context so that we can suggest suitable software algorithm's for the program.
__________________
Eric
"Good enough is Perfect"

PIC tutorials:
Nigel's site: http://www.winpicprog.co.uk/
Gramo's site: http://www.digital-diy.net/
ericgibbs is online now   Reply With Quote
Old 30th April 2008, 09:41 AM   #30 (permalink)
Experienced Member
 
Join Date: Oct 2006
Location: Hyderabad, India.
Posts: 1,249
mvs sarma is a glorious beacon of lightmvs sarma is a glorious beacon of lightmvs sarma is a glorious beacon of lightmvs sarma is a glorious beacon of lightmvs sarma is a glorious beacon of light
Send a message via MSN to mvs sarma Send a message via Yahoo to mvs sarma
Default

Quote:
Originally Posted by blueroomelectronics
R1 & R2 only have one side connected. What sort of humidity sensor are you using?
What language are you going to program it with?
As the switches are found to ground, perhaps R1 to R3 might be pull-up resistors.

@engineergirl27,
please put your combined code for both functions as an ASM file instead of Text. It will be useful to analyze
__________________
Regards,
Sarma.
mvs sarma is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes



Similar Threads
Thread Thread Starter Forum Replies Latest
Uni Project Advice 2-tone Electronic Projects Design/Ideas/Reviews 7 18th October 2007 12:11 AM
My professor screwed my final electronics project! kungfusansu Electronic Projects Design/Ideas/Reviews 21 26th August 2007 09:57 PM
RPM Counter (Project Started PIC16F877A) Ayne Micro Controllers 28 2nd May 2007 01:53 PM
PIC16f877A Project help Alex Ng Micro Controllers 5 26th July 2006 07:48 AM
A Microcontroller based Analogue Waveforms Analyzer Project km Electronic Projects Design/Ideas/Reviews 76 30th June 2004 06:40 PM


All times are GMT. The time now is 02:13 PM.


Electronic Circuits  |  Radio Controlled
Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.1.0 (Unregistered)