Friday, March 1, 2013
Generador simple de Onda cuadrada CCS
/////////////////////////////////////////////////////////////////////////
//// ////
//// This program displays a message over the RS-232 and waits for ////
//// any keypress to continue. The program will then begin a 1khz ////
//// square wave over I/O pin B4. ////
//// ////
//// Comment out the printf's and getc to eliminate the RS232 and ////
//// just output a square wave. ////
//// ////
//// Change both delay_us to delay_ms to make the frequency 1 hz. ////
//// This will be more visable on a LED. ////
//// ////
//// ////
//// Change the device, clock and RS232 pins for your hardware if ////
//// needed. ////
/////////////////////////////////////////////////////////////////////////
#include <30f2010 .h="">30f2010>
//#device ICD=TRUE // For using the debugger, un-comment
#use delay(crystal=20mhz)
// UART1A specifies the alternate UART pins Pin_C13, Pin_C14
// use UART1 to sprcify UART for pins Pin_F3, Pin_F2
#use rs232(baud=9600, UART1A)
void main() {
printf("Press any key to beginnr");
getc();
printf("1 khz signal activatednr");
while (TRUE) {
output_high(PIN_B4);
delay_us(500);
output_low(PIN_B4);
delay_us(500);
}
}
Currently have 0 comentarios: