Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

PIC16F690 rocket ship project help

Status
Not open for further replies.

Lori

Newbie level 2
Joined
Sep 16, 2009
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,328
Hi I am an engineering student, and I am doing a project in assembler (C is not allowed) dealing with a PIC16F690 microchip. The project is a space orbitor that loses its throttle with altitude as well as its rocket boosters and fuel tank. Full throttle is 5v and 10% throttle is 0.01V
The project is fairly complex but apparently easy to code. I am a beginner at this and Im seriously struggling. I was wondering if anyone could help me with some "checking" codes to see-if the altitude is at 20km the rocket boosters will be jettisoned off and if it is at 50km the fuel tank and at 100km the engine switches off i.e. what would be a while statement in C.
Also if anyone knows how to deal with pulse width modulation using a base signal and a filter circuit that would be a great help :)
 

You're going to have to make an effort yourself, start with a block or schematic diagram. Then work on your code and post it.
 

ok well i have some code and its not quite working apparently my lookup table is wrong which i will deal with so im not going to include the table in this code... i do however need to set a resolution in the adc to use 8bits in the lsb range and not the full 10bits...so any coding will help?
As well as that im unsure of if my logic for my checks is going to work... i want to switch on an LED when the altitude reaches 20km and another at 50 and another at 100km...so help there would be great??

Thanx :)

cblock 0x20
;Delay1 ; Assign an address to label Delay1
;Delay2
;Display ; define a variable to hold the display
Air_Pressure_sensor ; ADC input
Altitude ; Calculated from ADC
Hydrogen_Pump_val
Oxygen_Pump_val
TEMP_VALUE
endc

#define Fuel_Tank_release PORTC,0 ; Shown on LED DS1
#define SRB_Release PORTC,1 ; Shown on LED DS2
#define Engine_ShutDown PORTC,2 ; Shown on LED DS3
#define Hydrogen_Pump PORTB ;(*Make Hydrogen_Pump & Oxygen_pump Pumps PortC,6 (PWM)
#define Oxygen_Pump PORTC

;........................................................................................................................
; Initialisation
;........................................................................................................................
org 0
Start:
bsf STATUS,RP0 ; select Register Page 1
movlw 0xFF
movwf TRISA ; Make PortA all input
clrf TRISC ; Make PortC all output
movlw 0x10 ; A2D Clock Fosc/8
movwf ADCON1
bcf STATUS,RP0 ; back to Register Page 0

bcf STATUS,RP0 ; address Register Page 2
bsf STATUS,RP1
movlw 0xFF ; we want all Port A pins Analogue
movwf ANSEL
bcf STATUS,RP0 ; address Register Page 0
bcf STATUS,RP1

movlw 0x01
movwf ADCON0 ; configure A2D for Channel 0 (RA0), Left justified, and turn on the A2D module
movlw 0x08
;movwf Display

ADCREAD:
; movf Display,w
movwf PORTC
nop ; wait 5uS for A2D amp to settle and capacitor to charge.
nop ; wait 1uS
nop ; wait 1uS
nop ; wait 1uS
nop ; wait 1uS
bsf ADCON0,GO ; start conversion
btfss ADCON0,GO ; this bit will change to zero when the conversion is complete
goto $-1

swapf ADRESH,w ; Copy the display to the LEDs
movwf Air_Pressure_sensor
movf Air_Pressure_sensor
movwf PORTC
goto LOOKUPStart

LOOKUPStart:
MOVF Air_Pressure_sensor, W ;MOVES AIR PRESSURE VALUE INTO LITERAL
ANDLW 0XFF ;MASK UNWANTED BITS
CALL AltitudeTable ; GO TO LOOKUP
MOVWF Altitude ; vALUE FROM LOOKUP
GOTO C20KM ;LOOPS START
; Look up table

;cHECKING
;-------------------------------------------------------------------------------------------------------------------------------

C20KM:
MOVF Altitude,W ;MOVES COUNTER_PRES VALUE INTO WORKING
SUBLW D'20' ;SUBTRACTS 20 FROM WORKING TO CHECK FOR IF THE ALTITUDE IS AT 20 KM
BTFSC STATUS,C ;CHECKS THE C REGISTER OF STATUS AND SKIPS NEXT COMMAND IF 0
GOTO FTR ;GOES TO FUEL TANK RELEASE PROCEDURE

C50KM:
MOVF Altitude,W ;MOVES COUNTER_PRES VALUE INTO WORKING
SUBLW D'50' ;SUBTRACTS 20 FROM WORKING TO CHECK FOR IF THE ALTITUDE IS AT 20 KM
BTFSC STATUS,C ;CHECKS THE C REGISTER OF STATUS AND SKIPS NEXT COMMAND IF 0
GOTO SRBR ;GOES TO SOLID ROCKET BOOSTER RELEASE PROCEDURE

C100KM:
MOVF Altitude,W ;MOVES COUNTER_PRES VALUE INTO WORKING
SUBLW D'100' ;SUBTRACTS 20 FROM WORKING TO CHECK FOR IF THE ALTITUDE IS AT 20 KM
BTFSC STATUS,C ;CHECKS THE C REGISTER OF STATUS AND SKIPS NEXT COMMAND IF 0
GOTO EngineOff ;GOES TO FUEL TANK RELEASE PROCEDURE

GOTO BEGIN
;...............................................................................................................................
; Outputs
;...............................................................................................................................
FTR:
;banksel PORTC
bsf Fuel_Tank_release
GOTO C50KM

SRBR:
bsf SRB_Release
GOTO C100KM


EngineOff:
bsf Engine_ShutDown
end
 

Your only getting 8 bit your code is reading the lower 8 bits
You have to read both registers to get the whole 10 bits
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top