/*
Programa para encender un led
MigSantiago, Marzo 2010
*/
#include <p32mx420f032h.h>
#include <plib.h>
//Entrada de cristal a 4MHz
//Para CPU será elevada a 80Mhz
//CPU
#pragma config FPLLIDIV = DIV_1, FPLLMUL = MUL_20, FPLLODIV = DIV_1 //80MHz
#pragma config POSCMOD = XT, FNOSC = PRIPLL, FPBDIV = DIV_8
#pragma config FSOSCEN = OFF //sin oscilador secundario
int main()
{
int i=0;
//Disable JTAG port
//Hace que las terminales RB10 y RB11 sean I/O
DDPCONbits.JTAGEN = 0;
//PORTSetPinsDigitalOut(IOPORT_B, BIT_0);
mPORTBDirection(0x0000); //todo b salida
while(1)
{
++i;
PORTWrite(IOPORT_B, i);
}
}
+ Los pines PGEC1 y PGED1, o PGEC2 y PGED2 conectados al programador Pickit2 (por ahora el único que lo puede programar)
This chapter is organized as follows:
Individual Peripheral Module functions and macros
• System Level Functions
• Prefetch Cache Functions
• DMA Functions
• Bus Matrix Functions
• NVM Functions
• Reset/Control Functions
• Interrupt Functions
• Oscillator Functions
• Power Save Functions
• I/O Port Functions
• Timer Functions
• Input Capture Functions
• Output Compare Functions
• SPI Functions
• I2C™ Functions
• UART Functions
• PMP Functions
• RTCC Functions
• A/D Functions
• Comparator Functions
• CVREF Functions
• Watchdog Timer Functions
Para LCD y perifericos por SPI o I2C hay o es mejor usar el hardware??
Para LCD y perifericos por SPI o I2C hay o es mejor usar el hardware??
/*
Programa para encender un led
MigSantiago, Marzo 2010
*/
#include <p32mx420f032h.h>
#include <plib.h>
//Entrada de cristal a 4MHz
//Para CPU será elevada a 80Mhz
//CPU
#pragma config FPLLIDIV = DIV_1, FPLLMUL = MUL_20, FPLLODIV = DIV_1 //80MHz
#pragma config POSCMOD = XT, FNOSC = PRIPLL, FPBDIV = DIV_8
#pragma config FSOSCEN = OFF //sin oscilador secundario
// Let compile time pre-processor calculate the PR1 (period)
#define SYS_FREQ (80000000L)
#define PB_DIV 8
#define PRESCALE 256
#define TOGGLES_PER_SEC 1
#define T1_TICK (SYS_FREQ/PB_DIV/PRESCALE/TOGGLES_PER_SEC)
int i=0;
//////////////////////////////////////////////////////////////////////////////////////////
int main()
{
//Disable JTAG port
//Hace que las terminales RB10 y RB11 sean I/O
DDPCONbits.JTAGEN = 0;
mPORTBDirection(0x0000); //todo b salida
//Configure Timer 1 using internal clock, 1:256 prescale
OpenTimer1(T1_ON | T1_SOURCE_INT | T1_PS_1_256, T1_TICK);
// set up the timer interrupt with a priority of 2
ConfigIntTimer1(T1_INT_ON | T1_INT_PRIOR_2);
// enable multi-vector interrupts
INTEnableSystemMultiVectoredInt();
while(1);
}
//////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////
//Interrupción timer 1
void __ISR(_TIMER_1_VECTOR, ipl2) Timer1Handler(void)
{
// clear the interrupt flag
mT1ClearIntFlag();
// .. things to do
// .. in this case, toggle the LED
++i;
PORTWrite(IOPORT_B, i);
}
//////////////////////////////////////////////////////////////////////////////////////////
Hay librerias de Delays y de impresion a puertos de comunicacion, como tiene CCS?? :shock:
Felicidades por el avance Santiago! :-/ Estoy ansioso por entrarle a estos micros, pero por ahora en reposo porque tengo posiblemente turno con el quirofano, apendicitis! :8}
Felicidades por el avance Santiago! :-/ Estoy ansioso por entrarle a estos micros, pero por ahora en reposo porque tengo posiblemente turno con el quirofano, apendicitis! :8}
Cuídate, tendrás que descansar de los pics un rato.
Que tal el simulador de MPLAB ??
Podremos ver estos ejemplos alli??
Al menos hasta que tengamos una plaquita hecha.
Yo pedi dos de estos:
PIC32MX795F512L (http://www.microchip.com/wwwproducts/Devices.aspx?dDocName=en545660)
Para tirar, apunto lejos!! :D :D :D
Yo pedi dos de estos: PIC32MX795F512L (http://www.microchip.com/wwwproducts/Devices.aspx?dDocName=en545660)
Gran sorpresa me lleve al darme cuenta que el PIC32MX795F512L, no posee ETHERNET!!! :shock: :shock:
The Ethernet controller is a bus master module that
interfaces with an off-chip Physical Layer (PHY) to
implement a complete Ethernet node in a system.
Saludos.
Aparte tanto estos ( PIC32 ), los ColdFire V1 de FreeScale, como los AVR32 salieron para hacerles frente a su peor enemigo los ARM Cortex M3. En cuanto salgan los PIC32 y los ColdFire V1 en encapsulados pequeños ( 16-20 pines ) chau a los micros de 8/16 bits.
Saludos !
...es que las variables int, long y sus compañeros ocupan todos 32 bits. Esto esta hecho a proposito porque todas las operaciones tienen el mismo tiempo de calculo y como estos micros poseen mayor cantidad de memoria decidieron hacerlo de esta manera
Pero un int en un JM60 Freescale de 8 bits, ocupa 16 bits...
Este es el que consegui me manden como muestra de National...
DP83848CVV
ya los consegui 2 32mx440f256h , y tengo el mplab 8.10 , ,, ya quiero empezar pero no tengo el pickit2 jejeje , un apregunta funciona con enigma?
y un aayuda para pasar un programa de 33fj a 32 mx, que considerar para variar el programa ??',, saludos