0
votes
1answer
75 views

Calling ports in C on my microcontroller

I have been developing a small OS for my lpc1313fbd48. I am sending all of the C and assembly code in a binary file. I want to be able to call the ports in C and have an LED turn on for a few seconds ...
0
votes
0answers
50 views

Store data in built-in Flash of PIC at runtime using C code

I am designing PIC16F877a based project that counts the number of people in a room and turn ON the relays in accordance with that number like if 5 persons in a room then One relay would be ON. I want ...
0
votes
2answers
255 views

Creating a lookup table in a microcontroller using in C

How can I create a lookup table in a microcontroller using C? I have one input and one output and want to implement a lookup table in C.
0
votes
1answer
55 views

PIC32 Issue with using JTAG Pins as Analog Inputs

I'm trying to read in a value using a few analog pins on a PIC32 (MX775F512H), including RB12-- part of the JTAG pins on the device. The device the board is reading from works great, but the board ...
2
votes
2answers
135 views

Understanding volatile class fields in AVR C++ programs

I'm having some confusion about what members to declare volatile in a program I'm writing in C++ for an AVR microcontroller, with interrupts. When it's plain C it makes sense - the compiler doesn't ...
12
votes
1answer
256 views

Sine signal generation using PWM

We are unable to generate a sine signal properly using a MC68HC908GP32 microcontroller. PWM description begins in page 349. Clock frequency is 2.4MHz, while we have used 7 kHz PWM by using the ...
2
votes
1answer
83 views

Bit Banging UART

My full code is located here. Basically, I'm transmitting to an Arduino, and I'm not receiving the correct value (you'll notice I'm trying to send d'22'). Here's the method where I actually bit bang ...
3
votes
2answers
186 views

Arduino LED brightness switching using pushbutton

I'm trying to switch between 4 different brightness of an LED using an Arduino Uno. I've used analogWrite and not digitalWrite with PWM. The problem i'm facing is that the brightness does not switch ...
5
votes
1answer
164 views

Serial Communication over 1 Pin?

Okay guys, I'm in a bit of a pickle here. I have the following circuit: As you can see, pin 3 is my only output. I've actually already had this board printed, so there's not much room for ...
0
votes
0answers
49 views

Interfacing with ROM chip(C, ASM, & Timing Diagrams)

I am attempting to interface with the following ROM chip via my mc9s12 microcontroller: http://www.alldatasheet.com/datasheet-pdf/pdf/55460/AMD/AM29F040B.html I have several functions written in C, ...
-2
votes
1answer
59 views

How to read in C from a .csv file (how to send the file to the uC) [closed]

For my project I am using an 32 bit uC from Renesas. I have implemented a serial communication so I can communicate with the uC via hyper terminal. The task I have to do now is to read values from a ...
0
votes
1answer
165 views

STM32 program not executing

I am currently trying to make my own stm32 development board. i have stm32f100c4t6 microcontroller mounted on pcb. I am using Atollic True studio free edition. i had made small blink led program ...
0
votes
2answers
80 views

Read from UART seems to overwrite while in buffer

I am reading sending data to a PIC32MX7xx using UART. The data frames are all 6 bytes long, no exception. The problem I am facing is that when there are 6 bytes waiting to be read and I send another ...
0
votes
1answer
60 views

PIC24H POT input to control LED blink delay not linear

Hello I'm using the PIC24H microprocessor and I wrote a simple program that takes input from a POT using analog input which is then set to a modulus value of delay. It does seem to set the delay, but ...
0
votes
0answers
38 views

Can you help me find a suitable MIPS eval board

I'm a ARM guy but recent events have me needing to port some of our code base to a MIPS device and profile it. Mainly concerned with processor utilization. The device target I'm looking for is a ...
2
votes
1answer
94 views

Writing parameters into Code memory at Run time during Initializations - 8051

I need to make this possibly. I am using keil IDE and the AT89c51RD2 MCU. At initialization, a function will be called to derive about 1500bytes. I want to write this byte to code memory (byte by ...
3
votes
2answers
122 views

Analog to Digital converter module of MCU - Conceptual question

Please consider the following codes: ...
5
votes
2answers
223 views

Decoding multiple quadrature rotary encoders

Scenario I have 4 ACZ16 quadrature rotary encoders connected to GPIO Port D on an ATMega168P. I am only trying to extract rotation direction from them. Position is irrelevant, and it is guaranteed ...
10
votes
3answers
292 views

Microcontroller Sleep Race Condition

Given a microcontroller that is running the following code: ...
0
votes
0answers
67 views

bmp085 output is little off

I have got this Bosch barometric sensor BMP085 and im trying to make library for ARM LPC2000 microcontroller. Basically i have everything running but my reading values are wrong. I have tested ...
2
votes
3answers
159 views

Why pic18fxxx microcontrollers is better for C language

Pic18fxxx family has a lot advantages and improvements from the pic16fxxx family of microcontrollers. What is the particular feature that make them better for C programming than the pic16fxxx devices? ...
1
vote
2answers
192 views

Apply PWM signal to PIN of a Microcontroller

I am using the MC9S08DZ60. I have been give a circuit diagram according to which i must program the micro-controller. I am using Code warrior with Processor Expert which allows me to initialize the ...
1
vote
2answers
293 views

AVR GCC : Global / Static Array not getting initialized properly

Im having problem with global arrays in my C code. What i am trying to do is to use a display buffer (array of 8 uint8_t with each uint8_t representing a row) to light up the leds in 8x8 led matrix ...
5
votes
1answer
412 views

Interrupt Service Routine in C - function at specific address

I need to add an Interrupt Service Routine (ISR) to existing code in C for a PIC18F4620 and a PIC18F46K22. As you can see in section 9 (of both datasheets), these devices have multiple interrupt ...
0
votes
0answers
71 views

Data loss between parsing and displaying on an 8 by 2 LCD

I'm trying to display strings that are larger than eight characters on the top row of am 8 by 2 LCD by making them scroll across the screen. I'm using a PIC16f1936 microcontroller and MPlab x IDE. ...
1
vote
1answer
228 views

How to change the frequency of PIC internal oscillator?

Internal oscillator of PIC16f884 doesn't change frequency in the following code: ...
1
vote
1answer
185 views

How to get two buttons to work with the 16f628a - C, Hi-tech comp, mplabx

I'm just began exploring my new hobby - mcu electronics. I have bought an 16f628a after reading some forumposts suggestion that is a good mcu for beginners. I have download mplabX, the hi-tech ...
15
votes
2answers
733 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 ...
1
vote
2answers
418 views

Measuring 32V using ADC of Atmega8

I'm trying to measure the battery voltage of 30V using the ADC of an AVR Atmega8, AVCC is connected to 5V. I connected a suitable voltage divider: R1 is 270k, R2 is 10k. The result I get is wrong at ...
3
votes
1answer
168 views

PROGMEM data vs. calculated data

On an arduino project I'm working on (ATMega328 at the moment) I have a bunch of vector distance data that I need to use for various pixels in a matrix. It's a relatively simple calculation: ...
25
votes
2answers
749 views

Who receives the value returned by main()?

I know that in computers, value returned by the main() function is received by the operating system. But, what happens in the ...
2
votes
3answers
824 views

Starting with I2C on PIC18s

For a project I'd like three PICs (two slaves PIC18F4620, one master PIC18F46K22) to communicate over the I2C bus. Later on, more slaves may be added (like EEPROM, SRAM, ...). I'm writing the code for ...
1
vote
1answer
223 views

On my Arduino, why is this LED always on, even though I told it to turn off?

I am a software developer trying to understand how computers work at a lower level. I have purchased the Adruino Uno Microcontroller and I have followed all of the tutorials from LadyAda. I have ...
1
vote
1answer
183 views

Timers and internal clock generator on Freescale MCU

I am using MC9S08AW60A with DEMO9S08AW60E Board (Freescale). I have studied about the timers given with the MCU. I wish to know how exactly to Implement timers by code. The Freescale suite also comes ...
1
vote
2answers
200 views

Switch on a LED: why doesn't this code work?

I am using DEMO9S08AW60E and using Codewarrior(Version: 5.9) with Processor Expert. ...
1
vote
2answers
157 views

How can I detect HIGH or LOW input on a NXP microcontroller?

I am using NXP micro-controller P89V51RD2. I need to detect HIGH or LOW from 2 single bits. How do I store input state to a pre-defined address so that my functions can detect it as data? I need to ...
1
vote
3answers
198 views

Ideal Hardware Timer Setup Routine

Imagine you were trying to write a C routine for an 8bit microcontroller that converted a desired timespan (be it seconds, milliseconds, hertz, etc). to the corresponding hardware timer preload value ...
1
vote
2answers
506 views

Interfacing AVR microcontroller to ADC, waveform generator and other peripherals

I am doing first project with AVR microcontroller ATmega32-A. In this project I am interfacing with ADC (AD7798), waveform Generator (AD9833), Multiplexer, Capacitive sensor, Demodulator. I have ...
1
vote
4answers
2k views

How to calculate phase shift between two sine wavefroms

I two sinewave signals with same frequency. I want to measure phase shift between two signals. There will be a small phase difference between two signals. I am using ATmega32-A micro controller and ...
-4
votes
2answers
191 views

problem with reading values in case

I am using ATmega32-A microcontroller and CodeVisionAVR compiler. I am able to read values from an AD7798 external ADC successfully. I am also generating wave from with an AD9833 using SPI ...
-1
votes
1answer
163 views

Logic needed to read and store values

I am new to programming. I have one input signal from waveform generator. I am giving this signal to one sensor and as well as channel 1 of multiplexer. The sensor output is giving to channel 2 of ...
-1
votes
1answer
219 views

what can be c or avr studio code for potentiometer binary voltage reading using adc of ATmega 88 [closed]

By setting potentiometer we have to check the led's at the output of the atmega 88.That is, if we rotate the potentiometer it will give some voltage variation on leds as output.As i am new to ...
4
votes
1answer
221 views

Formula calculation and printing negative value.

I am successfully reading external ADC value using ATmega32-A. ...
1
vote
2answers
295 views

Analog to digital conversion

I am using an Atmega32-A microcontroller and an AD7798 external ADC. I am able to set the ADC registers and read back ADC values. I have written the following code: ...
-1
votes
4answers
303 views

What are the pros/cons of C and C++?

What would be the pros and cons of using C++ over C for uC (AVR) programming ?
0
votes
1answer
137 views

Loop is executing infinite times

I am working with an ATmega32-A microcontroller. Using USART communication, I am displaying data on monitor and am using switch case to select different commands. In one of the commands I have written ...
2
votes
1answer
185 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 ...
8
votes
3answers
957 views

What is bit banging

I am new to microcontroller programming. I am using ATmega32-A controller and CodeVisionAVR compiler. I am using the waveform generator(AD9833) to generate a sinewave signal using SPI communication. I ...
1
vote
1answer
117 views

problem with printing function return value

I am new to programming. I have small doubt, I know this is simple question but I am confused. I have the following function: ...
1
vote
2answers
280 views

how to check SPI signals

I am working with ATmega32-A micro controller. I am trying to read ADC (AD7798) values. I am setting ADC registers as shown below. Images also attached. ...

1 2