The general purpose I/O ports allow the dsPIC30F to monitor and control other devices. Most I/O pins are multiplexed with alternate function(s). The multiplexing will depend on the peripheral features on the device variant. In general, when a peripheral is functioning, that pin may not be used as a general purpose I/O pin. All port pins have three registers directly associated with the operation of the port pin:
- TRISx-Data Direction register
- LATx I/O Port register
- PORTx I/O Latch register
When interfacing microcontroller to outside world we often need to make Analog/Digital conversions (ADC). In this example, we will make 5 ADC inputs scanning that is driven by interrupt. Data are placed in results buffer and sent to UART by using functions for conversion of integer value to string.
A relay is an electromagnetically controlled on-off switch, used to isolate control electrical circuit from part of circuit that contains load. Current flows through the coil of the relay and creates a magnetic field which moves a lever and changes the switch contacts.
Designing PCB is not easy and it usually requires a lot of experience. But what should you do if you have little or no experience? Do not worry. For simple PCB most of rules are not so important, so you will easily design it and gain some experience. In time when projects you do become more complex it is good thing to read advice of others. It is hard to say everything that needs to be said in one short text, but I found one that is very good in my opinion.