Input-Output Student Version
Input-Output Student Version
Input-Output Student Version
1. dsPIC30F 5V operation
2. dsPIC33F/E High Performance
Applications
In addition to the Mid-range PIC application
dsPIC Resources
dsPIC microcontrollers are relatively new devices. There
are few source of information:
1- dsPIC30F3014-4013 datasheet
2- dsPIC Master Reference Manual
Pinouts
Data Space is
separate for some
DSP instructions
and linear for MCU
instructions
Digital Inputs/Outputs
dsPICF4013 has 5 ports.
Not all the pin are available on each port.
PORTA- 1 bit, RA11
PORTB- 13 bits, RB0-12
PORTC- 3 bits, RC13-15
PORTD- 6 bits, RD0-3 and RD8-9
PORTF- 7 bits, RF0-6
PORTA
PORTBL
PORTBH
PORTF
PORTD
Bit 1
PORTA
PORTBL
Bit 2
Bit 3
Bit 4
RC13 RC14
RB3
Bit 5
Bit 6
Bit 7
RB6
RB7
RA11
RB0
RB1
RB2
RB4
RB5
PORTBH RB8
RB9
PORTD
RD0
RD1
RD2
RD3
RD8
RD9
PORTF
RF0
RF1
RF2
RF3
RF4
RF5
RF6
2- LATx
3- PORTx
TRISF=(LATF&0xfe);
Original TRISF
Mask
New TRISF
Mask
New TRISF
PORTF=0x0f;
Tutorial
1- Make PORTB output.
2- Make bits 0 and 1 of PORTB input.
3- Turn bit 3 on.
ADPCFG register
PORTB can be used as a digital I/O port or as analogue
input port for the ADC converter. ADPCFG is used to
assign each bit of PORTB as digital or analogue port.
Bit15
Bit14
Bit13
Bit12
Bit11
Bit10
Bit 9
Bit 8
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
PCF
G15
PCF
G14
PCF
G13
PCF
G12
PCF
G11
PCF
G10
PCF
G9
PCF
G8
PCF
G7
PCF
G6
PCF
G5
PCF
G4
PCF
G3
PCF
G2
PCF
G1
PCF
G0
ADPCFG=0x00ff;
void My_delay(int T)
{
int x,y;
for(y=0;y<T;y++)
{
for (x=0; x<300; x++);
}
}