Showing posts with label tools. Show all posts
Showing posts with label tools. Show all posts

Monday, March 1, 2010

Inserting code in blogger

In order to be able to insert source code in a post in blogger i´m using the below application:
WLWSourceCodePluginSetup.msi
Which is used by windows live writer.
It has several options like:
Type of source code (C, C++, phyton, basic, etc etc)
The result is something like this:
#include <18F2550.h>                            //Selecting the PIC
#fuses HS,NOWDT,NOPROTECT,NOLVP                 //Defining the fuses
#use delay(clock=20000000)                      //Clock speed
#use rs232(baud=115200, xmit=PIN_C6, rcv=PIN_C7)  //Defining the RS232 pins and including the libraries
void main() {
unsigned int8 i, value, min, max;
setup_adc_ports(AN0);
setup_adc(ADC_CLOCK_INTERNAL);            // Built-in A/D setup function
set_adc_channel(0);                       // Built-in A/D setup function
do {
printf("Sampling:");                      // Printf function included in RS232 library
delay_ms(1000);
min=255;
max=0;
for(i=0; i<=30; ++i) {
delay_us(50);                      // Built-in delay function
value = read_adc();                 // Built-in A/D read function
if(value<min)
min=value;
if(value>max)
max=value;
}
printf("\r\nMin: %2X  Max: %2X\n\r",min,max);    
} while (TRUE);
}
Related Posts Plugin for WordPress, Blogger...