atmel

Beginner: AVR C++ Atmel Studio 6

≡放荡痞女 提交于 2019-12-23 20:01:57
问题 I'm having an issue working out what libraries I have access to. I understand that I can use the Atmel Studio 6 IDE to program the microcontroler (Atmega328p) in C++; however, I can't work out where it is documented what libraries I have access to. For example, can I use the STL (so like, vectors, deques...)? If someone could point me towards some documentation, that'd be great. Thanks. 回答1: Atmel Studio 6 doesn't come with an implementation of STL. There are some libraries that avr-gcc comes

Atmel C Pin Manipulation Macros

无人久伴 提交于 2019-12-21 21:13:26
问题 So I have been programming in Atmel C for a while and I have gotten used to all the C bit manipulation, so now I want to hide it. I want to hide the bit manipulation not only to make my code more readable but also make it easier to maintain and modify in case our hardware changes or we make new hardware. So I am asking you what are the best macros for Atmel C for basic pin manipulation. The features I am looking for are: Set a Pin to be Input or Output Set an Output Pin HIGH or LOW Read the

GUI-Library for microcontroller [closed]

你说的曾经没有我的故事 提交于 2019-12-17 21:51:16
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 4 years ago . I want to create a GUI driven application for a micro-controller (Atmel XMEGA) that is connected to a 128x64 dots graphics LCD (EA DOGL128-6) and 4 buttons for navigation. Controlling the display itself (e.g. drawing pixels and characters) is no problem but in order to prevent me from reinventing the wheel I was

atmel sensor using printf

徘徊边缘 提交于 2019-12-13 17:41:16
问题 I'm learning embedded system. I have a atmel UC3-L0 and compass sensor. Now I install AtmelStudio and download some demo code into the board. But I have no idea where the function "printf" in demo code will appear the data. How should I do to get the data? 回答1: In order to use printf in ATMEL studio you should check the following things: Add and Apply the Standard serial I/O module from Project->ASF Wizard. Also add the USART module from the ASF Wizard. Include the following code snippet

State machine program design in FreeRTOS - vTaskStartScheduler in a switch statement

不羁的心 提交于 2019-12-12 04:44:50
问题 I have a program design question in FreeRTOS: I have a state machine with 4 states, and 6 tasks. In each state, different tasks must be executed, excepting Task1, which is always active: State 1: Task1, Task2, Task3 State 2: Task1, Task2, Task3, Task4 State 3: Task1, Task5 State 4: Task1, Task6 Task1, Task3, Task4, Task5 and Task6 are periodic, and each one reads a different sensor. Task2 is aperiodic, it sends a GPRS alarm only if a threshold is reached. The switching between the states is

how to write code for transfer data from internal memory via SPI Master to 2 slave

不羁岁月 提交于 2019-12-12 04:06:55
问题 I receive data from USB to the internal memory of Atxmega 128A1 if ( (SWITCHPORTL.IN & PIN1_bm) == 0 ) { j = 0; while (j < NUM_BYTES) { // Wait till there is unread data in the receive buffer while((USART.STATUS & USART_RXCIF_bm) == 0 ){}; // Read out the received data __far_mem_write(j+SDRAM_ADDR, USART.DATA); if (j == (NUM_BYTES-1)) { // Toggle LED 1 LEDPORT.OUTTGL = PIN1_bm; } j++; } } How to write code for transfer data from internal memory via SPI Master to two slaves such that odd and

reading ARM 9g20 GPIO using mmap wont work

懵懂的女人 提交于 2019-12-12 02:44:07
问题 I'm trying access the GPIO pins on Atmel's Arm9 9g20. My code below keeps getting failing at gpio = mmap(0, getpagesize(), PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0xFFFFF400); // start of GPIOA Could someone help me with my code and offer a bit of I/O example code to get me past this hump? Thanks. // gpio.c // compile arm-linux-gcc -o button button.c // #include<unistd.h> #include<sys/types.h> #include<sys/mman.h> #include<stdio.h> #include<fcntl.h> #include<string.h> // GPIO Registers //http:/

Array of macros in c — is it possible

拜拜、爱过 提交于 2019-12-11 12:18:39
问题 I was wondering if it is possible to create something like an array of macros. I've implemented the following code which works: struct led_cmds_ { ioport_pin_t *commands[LED_COUNT] ; } ; struct led_cmds_ the_led_cmd_ ; void populate() { the_led_cmd_.commands[0] = SPECIFICPIN(0); } and in main: int main(void) { //..... populate(); LED_On(the_led_cmd_.commands[0]); } SPECIFICPIN(x) is macro defined as: #define SPECIFICPIN(X) (LED##X##_PIN) What I was hoping for is a way to is a way to do

Avrstudio 4.19 toolchain using gcc 4.7.x

纵饮孤独 提交于 2019-12-11 10:27:16
问题 I'm using makefile style compiling of my ATMEGA projects. As legacy of Arduino IDE, develepment toolchain is mostly aimed to gcc 4.3.2. Avrstudio 4.19 + Jtagice MKII CN + gcc 4.3.2 + make works somehow. But my problem is that gcc 4.3.2 is rather buggy. I see e.g. random bugs related to optimization of non-volatile variables, register cached values are not always written back to memory and also wrong warning are annoying. Hence using gcc 4.7.0 solves problem but I cannot load any such a

C Undefined reference

独自空忆成欢 提交于 2019-12-11 08:02:07
问题 I have the following code: main.c #include "checksum.h" void main() { char *Buf ="GPGGA204502.005106.9813N11402.2921W1090.91065.02M-16.27M"; checksum(Buf); } checksum.c #include <stdio.h> #include <string.h> checksum(char *Buff) { int i; unsigned char XOR; unsigned long iLen = strlen(Buff); printf("Calculating checksum...\n"); for (XOR = 0, i = 0; i < iLen; i++) XOR ^= (unsigned char)Buff[i]; printf("%X \n",XOR); } checksum.h #ifndef CHECKSUM_H_INCLUDED #define CHECKSUM_H_INCLUDED void