Hi
I need some assistance with the following PIC16F84A questions!
Question 1
A PIC16F84A based circuit is connected to various sensors and acruators through interface electronics such that the sensors produce PIC compatible logic levels and the actuators respond to PIC logic levels. They are connected in the following way:
Port B bit 0 to a pressure sensor.
Port B bit 2 to a green status LED.
Port B bit 3 to a yellow status LED.
Port B bit 4 to a Red status LED.
Port A bit 0 to a solenoid operated valve.
Port A bit 1 to a motor-operated pump.
Port A bit 3 to a liquid level detector.
The other port pins are not connected to anything. Write, in PIC assembly code, the appropriate port intialisation for this system.
My attempt to this question!
bcf status rpo ; set bank 1
movlw B'00011111' ;all as inputs
movwf TrisA ;writing to tris A register
movlw B'00000000' ;all as outputs
movwf TrisB ;writing to tris B register
bsf status rpo ; set bank 0 to configure ports A & B.
I am not sure whwther this is a correct initialisation for the above system but my main problem is on the follow up question as shown below;
Question2 (follow up question)
The system in question 1 above is shown in figure 6 below. Write a pseudo-code description of the continuously operating process desribed below. Do not consider initialisation of the PIC in your pseudo-code and do not write any assembly code.
The yellow LED must be on only when the pump is on.
The Green lED must be on only when the valve is open.
The Red LED must be on only if the pressure level is too high.
When the liquid level is too low, close the valve then turn on the pump.
when the liquid level is too high, turn the pump off then open the valve.
If the pressure is too high turn the pump off then open the valve.
The other part of the question which I could not understand reads!
Briefly explain what the directive below tells the assembler to do:
CBLOCK 0x0C,...............ENDC
What does this sturcture do in a Pic program?
Yours
jw223
I need some assistance with the following PIC16F84A questions!
Question 1
A PIC16F84A based circuit is connected to various sensors and acruators through interface electronics such that the sensors produce PIC compatible logic levels and the actuators respond to PIC logic levels. They are connected in the following way:
Port B bit 0 to a pressure sensor.
Port B bit 2 to a green status LED.
Port B bit 3 to a yellow status LED.
Port B bit 4 to a Red status LED.
Port A bit 0 to a solenoid operated valve.
Port A bit 1 to a motor-operated pump.
Port A bit 3 to a liquid level detector.
The other port pins are not connected to anything. Write, in PIC assembly code, the appropriate port intialisation for this system.
My attempt to this question!
bcf status rpo ; set bank 1
movlw B'00011111' ;all as inputs
movwf TrisA ;writing to tris A register
movlw B'00000000' ;all as outputs
movwf TrisB ;writing to tris B register
bsf status rpo ; set bank 0 to configure ports A & B.
I am not sure whwther this is a correct initialisation for the above system but my main problem is on the follow up question as shown below;
Question2 (follow up question)
The system in question 1 above is shown in figure 6 below. Write a pseudo-code description of the continuously operating process desribed below. Do not consider initialisation of the PIC in your pseudo-code and do not write any assembly code.
The yellow LED must be on only when the pump is on.
The Green lED must be on only when the valve is open.
The Red LED must be on only if the pressure level is too high.
When the liquid level is too low, close the valve then turn on the pump.
when the liquid level is too high, turn the pump off then open the valve.
If the pressure is too high turn the pump off then open the valve.
The other part of the question which I could not understand reads!
Briefly explain what the directive below tells the assembler to do:
CBLOCK 0x0C,...............ENDC
What does this sturcture do in a Pic program?
Yours
jw223
Last edited: