-
Search Results
-
I need some help and input for my project.
I have made one voltmeter / ammeter using a pic microcontroller and one robot controller brain (that can talk). The first part works perfectly and I will test the second one coming days.
If it works I will move to the next stage that is to have the results from the first one transferred to the the second one which will spell them, so I will have visual (2×16 display) and audio from the robot brain.
Can I use UART communication for that ?
If so, can I use USB to UART TTL converter using PL2303HX for that ?
Thanks in advance.
With reference to the article Interfacing HC-SR04 Ultrasonic Distance Sensor with PIC Microcontroller, I am trying to change the microcontroller to PIC 16F676.
#define _XTAL_FREQ 8000000 #define RS RC5 #define EN RC4 #define D4 RC0 #define D5 RC1 #define D6 RC2 #define D7 RC3 //#include <xc.h> #include <htc.h> #include "lcd.h"; #include <pic16f676.h> // BEGIN CONFIG #pragma config FOSC = HS // Oscillator Selection bits (HS oscillator) #pragma config WDTE = OFF // Watchdog Timer Enable bit (WDT enabled) #pragma config PWRTE = OFF // Power-up Timer Enable bit (PWRT disabled) #pragma config BOREN = ON // Brown-out Reset Enable bit (BOR enabled) //#pragma config LVP = OFF // Low-Voltage (Single-Supply) In-Circuit Serial Programming Enable bit (RB3 is digital I/O, HV on MCLR must be used for programming) #pragma config CPD = OFF // Data EEPROM Memory Code Protection bit (Data EEPROM code protection off) //#pragma config WRT = OFF // Flash Program Memory Write Enable bits (Write protection off; all program memory may be written to by EECON control) #pragma config CP = OFF // Flash Program Memory Code Protection bit (Code protection off) //END CONFIG void delayMs(int x); void main() { int a; TRISA = 0b00010001; //RA0 as Input PIN (ECHO) TRISC = 0x00; // LCD Pins as Output Lcd_Init(); Lcd_Set_Cursor(1,1); Lcd_Write_String("Developed By"); Lcd_Set_Cursor(2,1); Lcd_Write_String("electroSome"); delayMs(3000); Lcd_Clear(); T1CON = 0x10; //Initialize Timer Module while(1) { TMR1H = 0; //Sets the Initial Value of Timer TMR1L = 0; //Sets the Initial Value of Timer RA0 = 1; //TRIGGER HIGH __delay_us(10); //10uS Delay RA0 = 0; //TRIGGER LOW while(!RA1); //Waiting for Echo TMR1ON = 1; //Timer Starts while(RA1); //Waiting for Echo goes LOW TMR1ON = 0; //Timer Stops a = (TMR1L | (TMR1H<<8)); //Reads Timer Value a = a/58.82; //Converts Time to Distance a = a + 1; //Distance Calibration if(a>=2 && a<=400) //Check whether the result is valid or not { Lcd_Clear(); Lcd_Set_Cursor(1,1); Lcd_Write_String("Distance = "); Lcd_Set_Cursor(1,14); Lcd_Write_Char(a%10 + 48); a = a/10; Lcd_Set_Cursor(1,13); Lcd_Write_Char(a%10 + 48); a = a/10; Lcd_Set_Cursor(1,12); Lcd_Write_Char(a%10 + 48); Lcd_Set_Cursor(1,15); Lcd_Write_String("cm"); } else { Lcd_Clear(); Lcd_Set_Cursor(2,1); Lcd_Write_String("Out of Range"); } delayMs(400); } } /************************************************************/ void delayMs(int x) { int i; for (x ;x>0;x--) { for (i=0;i<=110;i++); } }I am using Hi-Tech C compiler and getting following errors.
Error [1347] ; 0. can’t find 0x21 words (0x21 withtotal) for psect “text142” in segment “CODE” (largest unused contiguous range 0x1E)
Error [1347] ; 0. can’t find 0x12 words (0x12 withtotal) for psect “text140” in segment “CODE” (largest unused contiguous range 0x7)
Error [1347] ; 0. can’t find 0xF words (0xf withtotal) for psect “text144” in segment “CODE” (largest unused contiguous range 0x7)Forum: 8051 Microcontroller
How to display floating point values on LCD ? I am using MPLAB XC8 LCD Library.
I want to display data read from UART on 16×2 LCD with MikroC compiler & PIC16F877A microcontroller …
In my program I am sending data through USART terminal of MikroC, it is receiving correctly on virtual terminal in Proteus but not displaying on LCD.
Please check the code written in MikroCsbit LCD_RS at RB0_bit; sbit LCD_EN at RB1_bit; sbit LCD_D4 at RB2_bit; sbit LCD_D5 at RB3_bit; sbit LCD_D6 at RB4_bit; sbit LCD_D7 at RB5_bit; sbit LCD_RS_direction at TRISB0_bit; sbit LCD_EN_direction at TRISB1_bit; sbit LCD_D4_direction at TRISB2_bit; sbit LCD_D5_direction at TRISB3_bit; sbit LCD_D6_direction at TRISB4_bit; sbit LCD_D7_Direction at TRISB5_bit; char gps; void main() { Lcd_Init(); Lcd_Cmd(_LCD_CLEAR); Lcd_Cmd(_LCD_CURSOR_OFF); Lcd_Out(1,1,"log"); Lcd_Out(2,1,"lat"); UART1_Init(9600); here: if (UART1_Data_Ready() == 1) { // if data is received gps = UART1_Read(); delay_ms(100); } Lcd_Out(1,6,gps); Delay_ms(2000); goto here; }I’m trying send data to the PIC using the Terminal Window on Proteus, but something is wrong and I don’t understand why. I attached the Proteus project and *.HEX.
The PIC is 16F628a.
#define _XTAL_FREQ 8000000 #define RS RB0 #define EN RB3 #define D4 RB4 #define D5 RB5 #define D6 RB6 #define D7 RB7 #include <xc.h> #include "lcd.h" #include "uart.h" #pragma config FOSC = INTOSCCLK // Oscillator Selection bits (INTOSC oscillator: CLKOUT function on RA6/OSC2/CLKOUT pin, I/O function on RA7/OSC1/CLKIN) #pragma config WDTE = OFF // Watchdog Timer Enable bit (WDT disabled) #pragma config PWRTE = OFF // Power-up Timer Enable bit (PWRT disabled) #pragma config MCLRE = OFF // RA5/MCLR/VPP Pin Function Select bit (RA5/MCLR/VPP pin function is digital input, MCLR internally tied to VDD) #pragma config BOREN = ON // Brown-out Detect Enable bit (BOD enabled) #pragma config LVP = OFF // Low-Voltage Programming Enable bit (RB4/PGM pin has digital I/O function, HV on MCLR must be used for programming) #pragma config CPD = OFF // Data EE Memory Code Protection bit (Data memory code protection off) #pragma config CP = OFF // Flash Program Memory Code Protection bit (Code protection off) void main() { TRISB = 0b000000110; TRISA0 = 0; Lcd_Init(); Lcd_Clear(); Lcd_Set_Cursor(1,1); Lcd_Write_String("WAITING..."); UART_Init(9600); UART_Write_Text("Terminal is running!"); while(1) { if(UART_Data_Ready()) { Lcd_Clear(); RA0 = 1; Lcd_Write_String(UART_Read_Text); __delay_ms(1000); } } }The UART.h and LCD.h from https://electrosome.com/lcd-pic-mplab-xc8/ and https://electrosome.com/uart-pic-microcontroller-mplab-xc8/
Somebody know why the code is not working?
Topic: Custom Character LCD 4 Bit
Hi everyone.
I saw the Interfacing LCD with PIC Microcontroller – MPLAB XC8 on electroSome and I did the circuit. It works fine! But I’m wondering. Is there a way to create custom character?
How to connect more than 2 serial devices to an ARM microcontroller?
or how to use a single serial port of a microcontroller for 2 devices?Topic: PIC kit2 PWM
Hello LIGO..u are doing a great job..i am a newbie in microcontroller and i must confess this site helped me tremendously..i am trying to generate PWM pulses for certain applications..But PWM frequency is 100kHz..can i use the code available on this website https://electrosome.com/pwm-pic-microcontroller/ i am using PIC16F876A micro..THAnk u in advance
