Question

In: Computer Science

Using P18f4580 controller - Write a program in C using Timer1 and the largest prescaler possible...

Using P18f4580 controller - Write a program in C using Timer1 and the largest prescaler possible to generate a square wave with a frequency of 2.5kHz on PORTC RC5? (Assume XTAL = 20 MHz).

Solutions

Expert Solution

The C program for P18f4580 IS USED TO GENERATE A SQUARE WAVE ON PORT RC5 this is given as follows:

----------------------------------------------Code-----------------------

#include <p18F458.inc>
   ORG 0x00
   GOTO START
   ORG 0x30
START BCF TRISB,5
   MOVLW 0x30
   MOVWF T1CON
HERE MOVLW 0xFF
   MOVWF TMR1H
   MOVLW 0xCB  
   MOVWF TMR1L  
   BCF PIR1,TMR1IF
   CALL DELAY
   BTG PORTB,RC5
   BRA HERE
DELAY BSF T1CON,TMR1ON
AGAIN BTFSS PIR1,TMR1IF
   BRA AGAIN
   BCF PIR1,TMR1ON
   RETURN
   END

--------------------------------------------------------------------------------------------------------------

The code generates a square wave on port RC5.

----------------------------------------Please Upvote--------------------------------------------------------------------------------------


Related Solutions

Using P18f4580 controller - Write a program in C using Timer0 to generate a square wave...
Using P18f4580 controller - Write a program in C using Timer0 to generate a square wave with a frequency of 1kHz on PORTBRB5? (Assume XTAL = 20 MHz).
Please write a C++ program to find the largest number among three numbers using nested if...else...
Please write a C++ program to find the largest number among three numbers using nested if...else statements You need to prompt the user to enter three integer numbers from the keyboard, and then display the largest number among the three. Please create a function to find the largest number among three numbers, and call the maxAmongThree function in the main function.
• Write a C++ program to find the largest umber, smallest number and sum of all...
• Write a C++ program to find the largest umber, smallest number and sum of all the element of a given array of 20 integers • Note − Declare array to 20 numbers − Input values for 20 array elements − Find largest number − Find smallest number − Find sum of all numbers • Display the results
Write a C++ program to find K largest elements in a given array of integers. For...
Write a C++ program to find K largest elements in a given array of integers. For eeample, if K is 3, then your program should ouput the largest 3 numbers in teh array. Your program is not supposed to use any additional array.
Write a program using c++. Write a program that uses a loop to keep asking the...
Write a program using c++. Write a program that uses a loop to keep asking the user for a sentence, and for each sentence tells the user if it is a palindrome or not. The program should keep looping until the user types in END. After that, the program should display a count of how many sentences were typed in and how many palindromes were found. It should then quit. Your program must have (and use) at least four VALUE...
i need C++ program with possible comments what is going on,(a) Write a program that reads...
i need C++ program with possible comments what is going on,(a) Write a program that reads a char as input, and determines if it is a lowercase letter, uppercase letter, a digit or something else (call the last one a special character).
write a Program in C++ Using a structure (struct) for a timeType, create a program to...
write a Program in C++ Using a structure (struct) for a timeType, create a program to read in 2 times into structures, and call the method addTime, in the format: t3 = addTime(t1, t2); Make sure to use add the code to reset and carry, when adding 2 times. Also, display the resultant time using a function: display(t3);
Can you solve this C program by using Function? Q1. Write a C program to ring...
Can you solve this C program by using Function? Q1. Write a C program to ring the computer bell at any number of times you specify. Use the system clock as a delay, you need to include the time header file.
write C++ program using functions (separate function for each bottom) Write a program to find if...
write C++ program using functions (separate function for each bottom) Write a program to find if a number is large word for two given bottom base - bottom1 and bottom2. You can predict that a number, when converted to any given base shall not exceed 10 digits. . the program should ask from user to enter a number that it should ask to enter the base ranging from 2 to 16 after that it should check if the number is...
write a c++ program using micro soft visual studio 2010 to write a program and store...
write a c++ program using micro soft visual studio 2010 to write a program and store 36 in variable x and 8 in variable y. add them and store the result in the variable sum. then display the sum on screen with descriptive text. calculate the square root of integer 36 in x. store the result in a variable. calculate the cube root of integer 8 in y. store result in a variable. display the results of square root and...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT