Advertisement

[x]
Attachment Details

Assembly Language program with a MCU

[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

7.3
OK, I am stressed out from this. I am working on senior design and I have gotten pretty far on my program but now I am stuck.  I need to program a PIC16F877a to take in 3 inputs
1.) Temperature Sensor Analog voltage
2.) WindSpeed Sensor 8 bit binary
3.) Humidity Sensor Frequency
I know how to take the inputs and display them but I need to convert them to Wind chill and heat index.

The equation for wind speed is:
35.74+0.6215T-35.75(V^0.16)+0.4275T(V^0.16)
T =the temperature from the temp sensor in degrees Farenheit
V= Velocity of the wind sped in mph

And the equation for Heat index is:
HI = -42.379 + 2.04901523T + 10.14333127R - 0.22475541TR - 6.83783x10 -3 T 2
- 5.481717x10 ^-2 R ^2 + 1.22874x10 ^-3 T 2R + 8.5282x10 ^-4 TR^ 2 - 1.99x10 -6 T^ 2 R ^2
T= the temperature
R=Relative humidity.

I am feeling that this is a very big task, it needs to be done by next week friday, hopefully before for testing. I just don't know if it is possible to do all that math in Assembly Language.

Is there a way to program in C then translate into Assembly.  
Please any help is greatly appreciated.

If I forgot anything please ask.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
#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
Related Solutions
Related Solutions
 
Loading Advertisement...
 

Rank: Master

Expert Comment by Infinity08:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Author Comment by engineergirl27:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 

Rank: Master

Accepted Solution by Infinity08:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
Loading Advertisement...
20080924-EE-VQP-40 / EE_QW_2_20070628