Question

In: Electrical Engineering

Write an instruction sequence to configure the A/D converter of the PIC18F452 to operate with the...

Write an instruction sequence to configure the A/D converter of the PIC18F452 to operate with the following parameters:

Conversion result right justified

fosc=32 MHz

Highest ambient temperature may reach 600oC

Use VDD and VSS as the high and low reference voltages

Convert channel AN0

Enable A/D Module

Solutions

Expert Solution

#include <p18f4620.h>

#include <UF_LCD.h>

#pragma config OSC = INTIO67                                       

#pragma config WDT = OFF                                             

#pragma config LVP = OFF                                             

void main(void){

int    adc_result;                                            

OSCCON = 0xF6;                                             

ADCON1 = 0x0F;                                            

lcd_init();                                                   

ADCON0 = 0x11;                                            

ADCON2 = 0x88;                                           

lcd_char('0');                                                

lcd_char('x');                                               

while (42){

ADCON1 = 0x0A;

ADCON0 |= 0x02;

while (ADCON0bits.GO == 1);

adc_result = ADRES;

ADCON1 = 0x0F;

lcd_byte((adc_result >> 8) & 0x03);

lcd_byte(adc_result & 0xFF);

lcd_command(0x82);

}

}


Related Solutions

Define the following terms related to D/A converter;                                 &nbsp
Define the following terms related to D/A converter;                                               (i) resolution   (ii) accuracy    (iii) settling time         (iv) offset error      (v) gain error
write c++ program. 1. Time converter 2. Length Converter 3. weight Converter 4.Currency Converter 5. Temprature...
write c++ program. 1. Time converter 2. Length Converter 3. weight Converter 4.Currency Converter 5. Temprature Converter (C to F and F to C) time converter (minutes to second, second to minutes, hours to seconds, seconds to hours, minutes to hours, hours to minutes)
PLEASE ANSWER WITHIN 30 MINUTES!! Consider a simple instruction ADD C,D (c+d). i. Write down the...
PLEASE ANSWER WITHIN 30 MINUTES!! Consider a simple instruction ADD C,D (c+d). i. Write down the instruction format of above instruction and which operand address will be use to implement this instruction? ii. What will be the role of microprograming while executing the instruction? iii. What type of parallel processor system will use in it? iv. Draw a diagram that represents the solution when an interrupt is occurred during execution of “a+b” instruction. v. If you are supposed to use...
Instruction: Use Microsoft Visio to draw a use case diagram and a sequence diagram for the...
Instruction: Use Microsoft Visio to draw a use case diagram and a sequence diagram for the following business requirements. Online Recruiting System (website) 1) The Online Interview System: The search committee usually selects 3 to 5 candidates for a Skype interview. When the search committee starts a Skype interview, they connect their web browsers to an interview module developed by the company’s IT team (we call this type of software as home-developed software). The interview module then connects to Skype....
If A is a 32-bit address, typically an instruction sequence such as: lui x19, A_upper addi...
If A is a 32-bit address, typically an instruction sequence such as: lui x19, A_upper addi x19, x19, A_lower can be used to load the word at A into a register (in this case x19). a) How many bits of A are in A_upper? b) If the MSB of A_upper is 1, what would be the value of the leftmost 32-bits of register x19. Provide your answer in decimal. c) After the lui instruction, the rightmost 12-bits of x19 would...
Write the C code required to configure pin 0 on port B to be an input...
Write the C code required to configure pin 0 on port B to be an input with the pullup resistor enabled.
An 8-bit A/D Converter on a chip using 0.18um technology with a Vdd=1.8V is built using...
An 8-bit A/D Converter on a chip using 0.18um technology with a Vdd=1.8V is built using minimum size transistors (l=0.18um and w=0.36um). It has 22 transistors per bit in conversion and 128 transistors used for memory. The activity factor in the conversion modules is 0.1, while the activity factor in the memory blocks is 0.02. Assume each transistor contributes 3fF/um of gate capacitance and 0.24fF/um of diffusion capacitance. Estimate the switching power without capacitance when operating at 1MHz.
Write a program to detect the deadlock occurrence and write the sequence if there is a...
Write a program to detect the deadlock occurrence and write the sequence if there is a safe state. Noted: C or C++
Study how to use D/A converter regarding DAC0800 Manual (answer typed please) Understand the manual
Study how to use D/A converter regarding DAC0800 Manual (answer typed please) Understand the manual
Suppose you have an 8-bit A/D converter that has a full-scale input range of ︎2V to...
Suppose you have an 8-bit A/D converter that has a full-scale input range of ︎2V to ︎6V. When a particular voltage is applied, the computer records the hex number B3. Assuming a perfect calibration, answer the following questions: - What output voltage does this value correspond to? - What is the digitization (quantization) error in the voltage? - By how much percent would this error change if 12 bits were used to approximate the output instead of 8 bits? PLEASE...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT