microcontroller

Is it possible to generate random numbers using physical sensors?

好久不见. 提交于 2019-12-18 11:02:50
问题 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

Unit testing patterns for microcontroller C code

与世无争的帅哥 提交于 2019-12-18 10:52:35
问题 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. 回答1: You write

How to detect two or more button press (GPIO) at the same time by a microprocessor/microcontroller?

依然范特西╮ 提交于 2019-12-18 08:49:43
问题 As mentioned in the question , I was wondering whether it is possible for the controller to detect two button press simultaneously. I am new to controller programming and started with the basics - blinking LED, then moved to buttons and now trying to play around button presses. I wanted to set some flag when both buttons are pressed together . But as of I know, Only one ISR will be called in this case, thus detecting a single press. How can we achieve this... (In some electronic devices, it

Efficient implementation of natural logarithm (ln) and exponentiation

梦想与她 提交于 2019-12-18 03:31:40
问题 Basically, I'm looking for implementation of log() and exp() functions provided in C library <math.h> . I'm working with 8 bit microcontrollers (OKI 411 and 431). I need to calculate Mean Kinetic Temperature. The requirement is that we should be able to calculate MKT as fast as possible and with as little code memory as possible. The compiler comes with log() and exp() functions in <math.h> . But calling either function and linking with the library causes the code size to increase by 5

Efficient implementation of natural logarithm (ln) and exponentiation

天涯浪子 提交于 2019-12-18 03:31:02
问题 Basically, I'm looking for implementation of log() and exp() functions provided in C library <math.h> . I'm working with 8 bit microcontrollers (OKI 411 and 431). I need to calculate Mean Kinetic Temperature. The requirement is that we should be able to calculate MKT as fast as possible and with as little code memory as possible. The compiler comes with log() and exp() functions in <math.h> . But calling either function and linking with the library causes the code size to increase by 5

Initializing SD card in SPI issues

*爱你&永不变心* 提交于 2019-12-17 18:29:09
问题 I've had a look at Stack Overflow question Initialization of a microSD card using an SPI interface and didn't see any answers that matched my issue (that is, things I haven't already tried). I have a similar issue where I'm trying to access a SD card through a microcontroller's SPI interface (specifically an HC908). I've tried following the flow charts in the Physical Layer Simplified Specification v2.00 and it seems to initialize correctly on Transcend 1 GB & 2 GB and an AE&C 1 GB card. But

Allocating memory in Flash for user data (STM32F4 HAL)

心不动则不痛 提交于 2019-12-17 15:35:52
问题 I'm trying to use the internal flash of an STM32F405 to store a bunch of user settable bytes that remain after rebooting. I'm using: uint8_t userConfig[64] __attribute__((at(0x0800C000))); to allocate memory for the data I want to store. When the program starts, I check to see if the first byte is set to 0x42 , if not, i set it using: HAL_FLASH_Unlock(); HAL_FLASH_Program(TYPEPROGRAM_BYTE, &userConfig[0], 0x42); HAL_FLASH_Lock(); After that I check the value in userConfig[0] and I see 0x42 ..

Send a structure using UART [closed]

*爱你&永不变心* 提交于 2019-12-14 04:14:49
问题 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 last year . I have a two boards: - Master board (M board) - Slave board (S board) M board shall send a request to S board and the latter shall answer. The answer of the slave is a struct: typedef struct{ uint8_t userID; uint8_t userPass; uint16_t userData; }UserTypeDef; UserTypeDef User;

sending data from microcontroller to the computer using tiva series c

≡放荡痞女 提交于 2019-12-14 03:24:58
问题 I am using Tiva C Series TM4C123GH6PM with Code Composer Studio for getting data from another microcontroller of the same type. Well, I get the data in bytes. The Goal of project is to assemble each 8 bytes and convert them to double then send these double to the computer. I have to use USART to send the data to the computer. When I use USART, I have two Methods: One to get data from a USART_x: UARTCharGet(UART1_BASE) The other to send the data over USART_x: UARTCharPut(UART0_BASE,d) The

volatile keyword usage in ISR function in micro-controller programing

北慕城南 提交于 2019-12-14 00:04:25
问题 As a general concept Global variable ("value") used in ISR function should be declared as volatile to avoid compiler optimization. but my doubt is a global variable is used in sub-function "ISR-SUB" which is invoked in ISR, whether the global variable used sub-function which is invoked in ISR also needs to be declared as volatile ? unsigned int STATUS; // -----> needs to be declared as volatile ? void ISR-SUB() { STATUS = 1; -->accessed in sub function invoked in ISR which will be optimized