C is an imperative (procedural) systems implementation language. It was designed to be compiled using a relatively straightforward compiler, to provide low-level access to memory, to provide language constructs that map efficiently to machine instructions, and to require minimal run-time support. C ...
2
votes
4answers
443 views
ADC registers setup using spi communication
I'm new to microcontrollers - I'm trying to read external ADC values from an AD7798 ADC using SPI communication.
Initially I have to setup some ADC registers - some registers are not configured. To ...
13
votes
10answers
2k views
Programming languages for electronics engineers
I am an Electronics and Communications Engineering student, before I got to college, I have been interested in programming and computer applications. I had focused on designing Windows applications ...
4
votes
4answers
873 views
Problems communicating with I²C RTC
I'm using PIC18F4680 to work with PCF8583P RTC using C18 compiler (and compiler's library functions for hardware \$I^2C\$) and I can't figure out how to read data from it or to determine if written ...
15
votes
2answers
683 views
C coding design - function pointers?
I have a PIC18F46K22 and program it with the XC8 compiler. In the end, I'll have a system like a pc with stdin and stdout. So in ...
11
votes
7answers
4k views
Fast and memory efficient moving average calculation
I'm looking for a time and memory efficient solution to calculate a moving average in C. I need to avoid dividing because I'm on a PIC 16 which has no dedicated division unit.
At the moment, I just ...
8
votes
5answers
2k views
Start off with embedded C with ATmega32 (ATmega AVR series)
I have a ATmega32 board laying around and I figure it would be perfect to start off with microcontrollers. I once did some babbling in embedded C (thats when I got this board) but the flow was stopped ...
3
votes
3answers
4k views
How do I modulate PWM frequency in realtime with a Microchip dsPIC?
I'm trying to change the PWM output frequency roughly once a millisecond using a dsPIC33FJ256GP710, and I'm having mixed results. I first tried this:
...
3
votes
1answer
521 views
PIC18F4520 ADC Conversion in MC18
I have a dilemma.
I need to read ADC values from PIC18F4520. My configuration, and code, is as follows:
...
1
vote
3answers
657 views
Invensense IMU3000 with PIC
Has anybody experienced using the Invensense IMU3000 gyroscope with some microcontroller?
The hardware comes with a really good library integrating full control of its features. This library is ...
5
votes
5answers
195 views
Integer to ASCII in C18
I'm writing code for a PIC18F46K22 using the C18 compiler. I want to write the value of an integer \$n\$ in ASCII over the USART to my PC.
For \$n<10\$, it's easy:
...
3
votes
1answer
60 views
Integers >9999 in PIC C18
In this answer, I made a function to convert an integer to an ASCII string:
...
2
votes
1answer
108 views
Setting up an ATtiny45 as I2C master - SDA stuck low
I'm trying to control a DAC from an ATtiny45, but somehow the SDA line is stuck low. To find the problem in the code I did the following:
I simplified the circuit to only the controller with the ...
2
votes
1answer
179 views
Problem with while loop
I am trying to read external ADC AD7798 values using ATmega32-A controller. In the datasheet, Status register Bit 7 (SR7) indicates the conversion is finished or ...
2
votes
3answers
462 views
c18 coding advice / braces error / function declaration help
I have almost NO experience coding so please excuse the crude style and verbose commenting. I am trying to sample from 4 sensors (1 every 15 minutes). I thought it would be more efficient to have the ...
2
votes
1answer
326 views
Strange data from arduino LDR sensor
I'm getting strange data from my LDR sensor.
Without any significant changes in light is constantly goes from 0 to its max value 1023 and back.
What could be the problem? Is it possible my LDR ...