microcontroller

Arduino Serial Interrupts

只谈情不闲聊 提交于 2019-11-30 05:39:37
问题 I am working on an Arduino Mega 2560 project. At a Windows 7 PC I am using the Arduino1.0 IDE. I need to establish a serial Bluetooth communication with a baud rate of 115200. I need to receive an interrupt when data is available at RX. Every piece of code I have seen use “polling”, which is placing a condition of Serial.available inside Arduino’s loop. How can I replace this approach at Arduino’s loop for an Interrupt and its Service Routine? It seems that attachInterrupt() does not provides

Is it possible to generate random numbers using physical sensors?

孤街醉人 提交于 2019-11-30 00:35:03
I've heard about people using light sensors, geiger counters, and other physical sensors to generate random numbers, but I'm skeptical. Is there really a way to generate random numbers from taking measurements of the physical world (using an Arduino or any other microcontroller)? If so, would these numbers ever be really random? to clarify: the question is about the feasibility of using microcontroller-gathered data to generate random numbers that could be applied soundly to cryptography-- an alternative to relying on a device's entropy. Taking analog "real world" measurements usually is a

Unit testing patterns for microcontroller C code

断了今生、忘了曾经 提交于 2019-11-30 00:05:19
Although there are plenty of unit test frameworks that support C, I'm a little stumped on how to write unit tests for micro controller code (PIC in my case, but I think the question is more general than that). Much of the code written for micro controllers revolves around Writing configuration and data values to registers, reading incoming data from registers and responding to interrupt events. I'm wondering if anyone can provide some pointers on the most effective way to this. You write; "Much of the code written for micro controllers revolves around Writing configuration and data values to

Embed JVM into micro-controller [closed]

风格不统一 提交于 2019-11-29 22:50:45
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 2 years ago . I am new in embedded world. May be I am wrong. But I want a relevant solution. I just want to embed java environment into a MCU for ease to develop application. The MCU vendor have provide the C library for lcd, sensor, spi, buttons, UART, DIO etc etc. Can I embed java into this ?

What is the difference between baud rate and bit rate?

自作多情 提交于 2019-11-29 22:02:38
I am really having hard time understanding the difference. Some say they are same, while others say there is a slight difference. What's the difference, exactly? I would like it if you explained with some analogy. Bits per second is straightforward. It is exactly what it sounds like. If I have 1000 bits and am sending them at 1000 bps, it will take exactly one second to transmit them. Baud is symbols per second. If these symbols — the indivisible elements of your data encoding — are not bits, the baud rate will be lower than the bit rate by the factor of bits per symbol. That is, if there are

How to enforce the struct bit order with the GCC compiler?

萝らか妹 提交于 2019-11-29 17:53:34
问题 I was wondering if there is a GCC C Compiler directive that allows me to determine the bit order for packing of a structure? Something to the likes of: #pragma bit_order left The rationale for such a need is that I have the following structure: struct { union { unsigned char BYTE; struct { unsigned char B0: 1; unsigned char B1: 1; unsigned char B2: 1; unsigned char B3: 1; unsigned char B4: 4; }BIT; }ITEM; } myStruct; With this structure, I would like the compiler to pack it this way: Bit

How to make a delay in assembly for avr microcontrollers?

◇◆丶佛笑我妖孽 提交于 2019-11-29 14:51:13
I am having a problem in calculating delays. I want to make a delay for 1 sec when I am using 1MHz clock speed for my atmega128 microcontroller. I use proteus for simulation and avr studio for coding in assembly for atmel microcontroller. For example this code is for 8MHz clock microcontroller Delay_15mS: ; For CLK(CPU) = 8 MHz LDI dly1, 120 ; One clock cycle; Delay1: LDI dly2, 250 ; One clock cycle Delay2: DEC dly2 ; One clock cycle NOP ; One clock cycle BRNE Delay2 ; Two clock cycles for true 1 clock for false DEC dly1 ; One clock Cycle BRNE Delay1 ; Two clock cycles for true 1 clock for

Alternative languages for embedded programming

放肆的年华 提交于 2019-11-29 11:03:58
问题 I`m looking for alternatives programming languages (from assembly, C, C++ and basic) to embedded (microcontroller) programming. Is it possible for example, to program microcontrollers in C# or Java? Maybe Ruby or Python? If possible, please post development tools and hardware used. 回答1: There's also Lua. See eLua. 回答2: FORTH has been popular in embedded systems for a long time. I have no specific experience with it but it is very cleverly designed to provide a lot of functionality in a small

Graphics library for embedded systems without Linux? [closed]

只愿长相守 提交于 2019-11-29 01:59:04
It seems that any kind of graphic library like DirectFB or MiniGui requires some sort of underlying operation system like Linux or uClinux. I am challenged with writing a software for a micro controller with just 512kb flash, an LCD display and a touchscreen to display and handle some pictures and GUI parts. Do you know any library which just need a pointer to the video memory that also can handle lines, images and fonts? By the time you incorporate some third party solution you could have just written it yourself. For most if not all environments the screen is just a two dimensional array of

Writing C# debug output to .txt file

久未见 提交于 2019-11-29 01:25:02
I'm running code on a microcontroller with .NET Micro Framework , and I want my debug output to write to a text file. How does this work? Ekk Use Trace . It is designed to do what you need. using System; using System.Diagnostics; class Test { static void Main() { Trace.Listeners.Add(new TextWriterTraceListener("yourlog.log")); Trace.AutoFlush = true; Trace.Indent(); Trace.WriteLine("Entering Main"); Console.WriteLine("Hello World."); Trace.WriteLine("Exiting Main"); Trace.Unindent(); Trace.Flush(); } } The most flexible solution for using a out-of-the-box tracing is to make an application