This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
RDA5807 - SINGLE-CHIP BROADCAST FM RADIO TUNER | |
Autor: Tiago Melo | |
Blog: tiagohm.github.io/microcontrolandos | |
Compilador: MikroC PRO PIC | |
*/ | |
#define RDA5807P_ADDRESS 0x20 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Pinos do LCD | |
sbit LCD_RS at RB4_bit; | |
sbit LCD_EN at RB5_bit; | |
sbit LCD_D4 at RB0_bit; | |
sbit LCD_D5 at RB1_bit; | |
sbit LCD_D6 at RB2_bit; | |
sbit LCD_D7 at RB3_bit; | |
sbit LCD_RS_Direction at TRISB4_bit; | |
sbit LCD_EN_Direction at TRISB5_bit; | |
sbit LCD_D4_Direction at TRISB0_bit; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Demonstração do uso de um display de 7 segmentos com ATMEGA328P. | |
Autor: Tiago Melo | |
Blog: Microcontrolandos | |
Compilador: MikroC PRO AVR | |
Bibliotecas: | |
*/ | |
//Mascara de bits usado para escrever um digito no display |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//a memória para os parâmetros será alocada dessa forma: [n][p0][p1][...][pn] | |
//por isso usamos o endereço de n para obter o endereço dos outros parametros. | |
unsigned calcular_media(char n, ... ) { | |
char i; | |
unsigned res = 0; | |
for(i = 1; i <= n; i++) { | |
res += ((char*)&n)[i]; //aponta para o i-esimo parametro e recupera seu valor. | |
} | |
return (res / n); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
PCF8591 - Conversor Analógico-Digital e Digital-Analógico de 8 bits. | |
Autor: Tiago Melo | |
Blog: Microcontrolandos | |
Compilador: MikroC PRO PIC | |
Bibliotecas: Soft_I2C | |
*/ | |
#define PCF8591_ADDR(addr, rw) (0x90 | (addr << 1) | rw) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
MCP4725 - Conversor Analógico-Digital de 12 bits. | |
Autor: Tiago Melo | |
Blog: Microcontrolandos | |
Compilador: MikroC PRO PIC | |
Bibliotecas: Soft_I2C, Conersions, C_String | |
*/ | |
//Pinos do MCP4725. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void main() { | |
//Define o pino PB0 como saída para o LED. | |
DDRB.B0 = 1; | |
//Define o pino PB1 como entrada para o botão. | |
DDRB.B1 = 0; | |
//Habilita o resistor de pull-up do pino PB1. | |
PORTB.B1 = 1; | |
while(1) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
MCP41XXX - Potenciometro Digital de 256 posições e 1 canal. | |
Autor: Tiago Melo | |
Blog: Microcontrolandos | |
Compilador: MikroC PRO PIC | |
Bibliotecas: Soft_SPI | |
*/ | |
//Pinos do MCP41XXX. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
SSD1306 - Display monocromático OLED 128x64 | |
Autor: Tiago Melo | |
Blog: Microcontrolandos | |
Compilador: MikroC PRO PIC | |
Bibliotecas: Soft_I2C | |
*/ | |
/* Fundamental Command */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
MCP3201 - Conversor Analógico/Digital de 12-bits. | |
Autor: Tiago Melo | |
Blog: Microcontrolandos | |
Compilador: MikroC PRO PIC | |
Bibliotecas: LCD, Lcd_Constants, Conversions, C_String | |
*/ | |
//Pinos do MCP3201. |
OlderNewer