Questions tagged [pic]
PIC is a family of Harvard architecture microcontrollers made by Microchip Technology.
1,543
questions
-1
votes
0
answers
38
views
why does have in error in undefined symbols?
I'm trying to use a 4x4_keypad.h, LCD_16x2_4bit.h and osc_config.h to get my 4x4_keypad.c, Calculator.c and LCD_16x2_4bit.c cleaner and tidied up. But I get many errors that me and my colleagues can't ...
0
votes
0
answers
52
views
PIC16F15257 ISSUE with different output pin voltages
Anyone have an idea as to why a pic will have very different output voltages on certain pins ??
I use multiple outputs on one switch and sometimes the one pin will show 4 to 5 volts output in one ...
-1
votes
0
answers
23
views
Implementation of a real-time PWM control system using the CCP1 module of the PIC16F877 ( mplap and proteus)
On the electronic circuit of the diagram below, we want the µ.c to generate four PWM signals
in order to rotate a bipolar stepper motor at the speed of 1step/s without being altered by the
other ...
1
vote
1
answer
19
views
PICKLE Pic Programmer on RPi 4 Model B
Has anybody used this application PICKLE https://wiki.kewl.org/dokuwiki/projects:pickle with a Raspberry Pi 4 Model B?
PICKLE is an application developed in "C", which allows the RPi to use ...
0
votes
0
answers
25
views
PIC32M flash read issue
I've been having trouble in implementation of a read from flash (PFM) in an application using a pic32mz controller, written in C.
I'm using the code below within a function to declare a variable with ...
0
votes
0
answers
34
views
System Hangs by writing delay after Timer_init()
I am facing a strange issue while programming PIC18f45k22. I am initiating system modules and then I write a blocking delay for 3 seconds to wait for a touch screen to start (because I need to send ...
0
votes
1
answer
30
views
Wondering how to strangely preset the value of Timer0?
May I ask when setting the value for Timer0 why in some cases people have to use subtraction to represent the preset Timer0 instead of using its result directly (in this case, 175 )? And in this case ...
0
votes
3
answers
50
views
Linear interpolation works on Windows but not on my PIC18F, trouble with 8-bit arch?
I've implemented linear interpolation on my PIC18F device where I'm interpolating ADC values with intervals stored in EEPROM. I tested the code and it doesn't calculate properly. So I put it into my ...
0
votes
1
answer
29
views
How to check if a button is pressed twice within 500 ms (PIC16)?
I have a switch button that is connected to RB1. This button acts as a reset but it needs to be pressed twice for it to work. If the second press happens after 500 ms (relative to the initial press), ...
1
vote
1
answer
57
views
More than 256 operations in an 8 bit pic16F assembler
I am a rookie in assembly programming and I am currently doing a project using a temperature sensor on MPLAB and it's values to be displayed on a LCD.
In order to convert the raw values (0 to 255 ...
1
vote
0
answers
44
views
How to integrate CPPCheck in MPLABX 6.0 or netbeans?
Microchip added a MISRA check function in MPLABX 5.45 which is just plugin for the free CPPCheck and for me it works pretty well. In the further versions of MPLAPX the MISRA check was gone.
In MPLABX ...
0
votes
1
answer
112
views
build error "make: *** [.build-impl] Error 2"
I have this simple code for an initial project that my microcontrollersteacher asked.
Im using MPLAB IDE V6.00, the xc8 compiler.
But when i try to clean and build it this error in red collor code ...
0
votes
0
answers
35
views
The conditions of memory (heap size) of each blocks that should be met in harmony v3
I have tried to run TCPIP stack of harmony v3 default library in PIC32MX170F256B, but Memory allocation errors has occurred and that cause exceptions or freezing all threads.
Default TCPIP library of ...
1
vote
0
answers
22
views
Call of function without prototype error message with Delay1TCYx (1) ( C language )
We have a project that were running using C and a PICkit 3. Our issu is that we remain getting the same error message and arent sure whta the issue is. Any help / advice would be great.
void main (...
0
votes
1
answer
43
views
PIC16F877 display the result of ADC on LEDs with C language using MPLAB
I used PIC16F877 and my purpose is to choose CHANNEL 4 to display the analogue input AN4 value on PortD leds. The approximate value is about 1V. I wrote a code and however, no matter how I ran my code,...
0
votes
1
answer
21
views
More than one EndPoint on USB using PIC16F1455/1459
I am using a PIC16F1455 to collect data and send to a computer.
I used existing code for simple testing, which uses one end point only. Szymons code is my base, which I have expanded a bit.
I would ...
0
votes
0
answers
20
views
how to make output port "1" when using AC input
I am using an AC input in my project. My input signals period which comes to port of PIC pin is 20ms.Its almost square waveform. I want to check this signal in 30ms time-interval continuously and make ...
0
votes
0
answers
51
views
PIC18F array allocation
I have a array of struct with a const char* element and a char* element. I change the char* element value with memcpy then i call a function where i declare a char array and thats all. Depending on ...
0
votes
1
answer
71
views
How to make a countdown timer using PIC 16
My countdown timer starts with 30 minutes (3 for the tens place of minute, and 0 for the units place of minute, and the tens and units place of seconds). I followed this youtube video https://www....
0
votes
1
answer
61
views
using a port as a variable in pic microcontroller
I using PIC18f45k22 and I am trying to make a thermocouple library. This library requires LATCH to be assigned as a parameter variable. This is the created code.
#define B4_LATCH LATB4
unsigned short ...
0
votes
0
answers
34
views
is the any problem use fast_io(A) problem with PIC16F877?
When i define my code and run in proteus simulation, the leds which are connected to portA of PIC16F877 is not working. When i close the code like that "//use fast_io(A)" but i still use ...
1
vote
1
answer
53
views
How to check if a port (input) is high? PIC16 C program
I cannot understand why my code won't work. It works when I set the condition PORTA == 0x00 but not when PORTA == 0x01. How do you check if a bit is high? Below is my code and my schematic (Crystal ...
0
votes
1
answer
62
views
How do I iterate over adjacent PIC microcontroller registers?
I'm writing an application for a PIC18F45K80 microcontroller. I would like to retrieve bytes from the eight RXB1D registers. According to the datasheet, "Each receive buffer has an array of ...
2
votes
2
answers
55
views
PIC 16F84 PCLATH Bit3+4 unnecessary for CALL/GOTO?
I am trying to simulate the PIC16F84 and now need to implement PCL / PCLATH registers.
The PIC16F84 has 1K of Program memory.
The PCL is 8Bit wide, so in this case Bit 0 and 1 of PCLATH is used to ...
-2
votes
1
answer
46
views
please help me answer this for me? my final exam
enter image description here
Question 1- In a system like the one below, the user is expected to enter a 4-digit password. The first time the program runs, it should say "Enter Password". ...
1
vote
1
answer
107
views
why LCD does not display anything
#include <stdio.h>
#include <stdlib.h>
#include <xc.h>
#include <string.h>
#include <stdint.h>
#include "config.h"
#include "Uart.h"
#define ...
0
votes
0
answers
99
views
error: (1347) can't find 0x422 words (0x422 withtotal) for psect "maintext_split_2" in class "CODE" (largest unused contiguous range 0x3AD)
im on mplab, using C with PIC16F18326 and am getting the following error when i try to compile:
:0:: error: (1347) can't find 0x422 words (0x422 withtotal) for psect "maintext_split_2" in ...
0
votes
2
answers
60
views
PIC Programming for variable to switch between 2 states
New to programming. Using PIC18F4520 with a MM74C922N 4x4 matrix keypad connected to Port A bits 0 to 3. Basically this keypad has a 4 bit output(DCBA) that corresponds to what key was pressed based ...
1
vote
1
answer
52
views
How do I turn a Fitec FS90R servo motor 90 degrees clockwise and anti-clockwise using a PIC18F4550
I have tried varying the duty cycle of the servo motor but it only turns 180 degrees clockwise and anti-clockwise.
2
votes
1
answer
81
views
Why doesn't my program recognize the PORTbits.RCx == 0 condition?
void UART_init(void){
ANSELB = 0; //set PORT B to digital port
TRISBbits.TRISB5 = 1; //set RX pin to input
TRISBbits.TRISB7 = 0; //set TX pin as output
SPBRGH = 0;
SPBRGL ...
2
votes
2
answers
101
views
Is it possible to create a PIC firmware binary that supports multiple different microcontrollers?
Due to the current chip shortage, I have had to purchase PIC microcontrollers that have a different specification to what was initially designed.
Initial: PIC24FJ256GA606
Revision 1: PIC24FJ512GA606
...
2
votes
1
answer
75
views
Cant combine 2 values together?
I'm using the PIC18lF47k42 with XC8 compiler.
I'm trying to get this full 12bit ADC value so I have the full resolution however, I can't seem to get the 4 bits of data from ADRESL to go into result ...
0
votes
0
answers
64
views
Trouble with i2c communication with mpu6050 Gyro and pic16f1829
I've been working on this project for awhile and I can't seem to correctly set up the i2c in able to read the data that the MPU6050 outputs. In order of code I have the Main.c, i2c.h, and i2c_MPU.h
#...
-3
votes
1
answer
436
views
Programming a 7 segment display based on push button [closed]
New to PIC programming or just programming in general. Wondering how I can display a number on the 7 segment display that corresponds to the number of times the push button at RA5 is pressed. E.g ...
0
votes
0
answers
64
views
Generating character base on 4-bit input
I am extremely new to PIC programming and need some help. I am using MPLAB v3.55 with xc8 compiler. Basically, I want a code to generate a character based on the truth table below. I am using a ...
0
votes
0
answers
60
views
What is wrong with this PIC16F877A HCSR04 example?
I am working on distance sensor with PIC16F877A.
I am using MPLAB IDE AND XC8 compiler.
My goal is to gradually turn on the right leds at certain distance levels, but the leds are blinking unstable. ...
0
votes
1
answer
72
views
Some SD cards fail to write (CMD24 returns CRC error)
I'm using a PIC18 to write to SD cards via SPI. For many cards, this is working file BUT for some cards I pass the init process but when trying to write to the card, CMD24 returns 0x05 (which I ...
0
votes
1
answer
151
views
How to develop for PIC32MM without either MPLABX or XC32
While working for just one month with the MPLABX5.5 + XC32 3.01 I've already had 3 separate instances where code compiled incorrectly, causing my program to fail after either the stack or frame ...
0
votes
1
answer
85
views
PIC Programming Counter and Touch Sensor Issue
I am new to this PIC programming and currently using C to program because ASM would take a bit time to learn. However, it seems like i am running into the most basic issue of all. The counter i setup ...
0
votes
0
answers
49
views
For loop iterates without incrementing [duplicate]
I have a for loop that prints the iterator to a 16x2 LCD screen. It prints "000", waits 500 ms, and then prints "001" over and over (the LED on RB0 blinks) without incrementing. I ...
1
vote
1
answer
106
views
Difference between PORT and LAT on an PIC18F
I am currently working on a PIC18F and I wonder what the difference is between a PORT and a LAT because looking at the documentation of the PIC18F they both do the same thing.
1
vote
0
answers
68
views
Display control PIC24FJ128GC010
I work with the PIC24FJ128GC010 on the MPLAB® Starter Kit for Intelligent.Integrated.Analog with the compiler XC16. I will read the 16-bit-Sigma-Delta ADC and show the result on the LCD-Display. I ...
0
votes
0
answers
32
views
PIC18F46Q84 sending empty CAN messages
Although I put a specific device above, I think my question is more generally applicable to the new Q series PIC chips. I am using the Microchip CAN example at https://github.com/microchip-pic-avr-...
1
vote
2
answers
258
views
PWM settings in PIC24FJ64GA002
Good day, I am working with a PIC24FJ64GA002 microcontroller and am struggling to get the PWM working for a servo I want to use. My code is as follows:
// PIC24FJ64GA002 Configuration Bit Settings
//...
0
votes
1
answer
62
views
PIC16 not updating ADC values
Can somebody help to explain why my code or setup not updating the ADC values of a 10K-potentiometer please?
I use MPLAB XPRESS PIC16F18877 board and MPLAB MCC to generate the code. The voltage result ...
2
votes
2
answers
333
views
How to put a variable at a specific memory location in SDCC
For low-level programming, sometimes it's necessary to say, at a given memory location, this is where my address is. For this post, the example is the PIR1 register in the PIC16F886 and related ...
0
votes
1
answer
160
views
Issue in implementing capacitive touch in PIC18F26K40 microcontroller using mTouch library
i currently working on PIC microcontroller. I have PIC18F26K40. I want to use CVD (Capacitive Voltage Divider) technique to implement capacitive touch button. I am using mTouch library of MCC (...
0
votes
1
answer
125
views
PIC SPI Beginner Problems (XC8 MCC)
I've recently got I2C working in no time with some MCC generated functions which are well documented in the .h file, however SPI gives me nothing and is causing me frustraions, not helped by the fact ...
1
vote
1
answer
191
views
member reference base type 'volatile unsigned char' is not a structure or union
I was trying to program a PIC 16f877A Micro-controller to rotate a servomotor, 0 to 180 degrees, but every time i try to build the program i get an error "member reference base type 'volatile ...
-2
votes
1
answer
129
views
Any clue as to why my code has errors in it? [closed]
I used MPLAB X IDE (a software for microcontrollers) to compile my code, but for some reason it keeps saying that there are at least two errors (specifically in the area that is bolded). I tried ...