embedded

How do DHT22 and gpio's work?

痞子三分冷 提交于 2019-12-13 08:56:58
问题 I just got myself a sensor DHT22 for temperature and humidity and I have some doubts: - Is this device only usable with arduino or Rpi? - If the answer is No, how does it work with the GPIO? As far as I understand, gpio has2 options: -Direcion (in or out) and Value (0 or 1). So according to this, I was checking a lot of examples for arduino and Rpi on how to use this devices, and all are attached to gpio's port. So how is this working? Does c/c++ has bigger capacity to handle this readings? -

Global variables modified by main() and accessed by ISR()

北城以北 提交于 2019-12-13 07:44:22
问题 Here is my c code char global_variable = 0; ISR(){ PORTA = global_variable; toggle_led;//to make sure that the interrupt is triggered } int main(){ while(1){ _delay_ms(500); gobal_variable++; PORTB = global_variable; } return 0; } The bottom line is that I have a global variable modified by the main function and read by both the main and ISR - interrupt handler . When the global variable is read by main I get the expected values, but in ISR I get the value that was first assigned to the

Can I use UART on MSP-EXP430F5529LP from Energia in order to communicate on pins p3.3 and p3.4 (rx and tx respectively)?

大兔子大兔子 提交于 2019-12-13 06:14:55
问题 Can I use UART on MSP-EXP430F5529LP from Energia in order to communicate on pins p3.3 and p3.4 (rx and tx respectively)? I already use UART in order to communicate with my PC via USB. To do so, I use Serial.println() and such. Now that one UART is taken, how do I configure and use second UART to go to these pins? Or would it be better to rewire my Bluetooth chip (BlueGiga wt32) to some other pins? Configuration aside, Serial does not seem to allow for multiple UARTs. How does it know which

Additional data present in flash after last loaded section of elf

感情迁移 提交于 2019-12-13 05:24:07
问题 I have a STM32 project which involves a bootloader. The bootloader CRCs the entire application region of flash and then compares this value against a firmware header stored just after the application image region in flash. I wrote a python script which runs after the binary is built. The script takes the elf file resulting from the build, and loads each section into a "virtual flash" image, which represents what should be exactly what is present on the mcu after the elf would be normally

How to make my data types independent of compiler in c

被刻印的时光 ゝ 提交于 2019-12-13 05:07:44
问题 I was studying uC/OS and read this article: Because different microprocessors have different word length , the port of μC/OS-II includes a series of type definitions that ensures portability Specifically, μC/OS-II’s code never makes use of C’s short, int and, long data types because they are inherently non-portable. Instead, I defined integer data types that are both portable and intuitive as shown in listing 1.1. Also, for convenience, I have included floating-point data types even though μC

Send SMS with STM32l152 and SIM900

為{幸葍}努か 提交于 2019-12-13 05:03:32
问题 I send the SMS "Hello World", but on my cellular I get this message ATAT+CMGS="xxxxxx">HelloWorld instead. What can be causing this? void controlAT() { clearString(); wait_ms(100); SIM900.printf("AT\r"); wait_ms(1000); if(result=="\r\nOK\r\n") { pc.printf("\r\n----OK AT----\r\n"); }else { pc.printf("-- ERROR AT --"); } pc.printf("%s",result.c_str()); } /*send SMS */ void sendSMS_Raw() { clearString(); SIM900.printf("AT+CMGS="); SIM900.printf("\""); SIM900.printf("+xxxxxxxxxxxxx"); SIM900

How to use global variable in Inline Assembly in Greenhills Compiler?

徘徊边缘 提交于 2019-12-13 04:58:39
问题 I want to use a global variable in inline assembly. asm(" LDR R0,g_TsInitStackPointerAddress"); Here g_TsInitStackPointerAddress is a global variable. While compiling its not showing any error . But while linking it shows the following error [elxr] (error) out of range: 0x1001326 (unsigned) didn't fit in 12 bits while performing relocation type R_ARM_POOL (4) at address 0x10013e0 from InitStack+0x20 (drv.o(.text)+0x1a4), to g_TsInitStackPointerAddress+0x0 ((COMMON)+0xb6) Here My function name

Why is Timer1 not counting up on PIC18?

允我心安 提交于 2019-12-13 04:38:03
问题 Initially I had Timer0 working fine during the run mode. The only problem is when the device goes to sleep mode, Timer0 stops counting up until awaken. In the datasheet it says to use Timer1 to be able to monitor time during sleep mode. I modified timer0 existing code to timer1 new configurations, the other code is pretty much the same. However, there is something I might have missed that is different about timer1 than timer0, since the timer1 is not counting up at all. The PIC I'm using is

Memory management for layered communications stack on embedded system [closed]

一个人想着一个人 提交于 2019-12-13 03:49:15
问题 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 9 months ago . This question pertains to programming on embedded systems. I'm working on an experimental communication stack on an embedded device. The stack receives stream data from the underlying channel, detects discrete packets, reassembles fragmented data, etc... Each function is

Why not to use mutex inside an interrupt

谁说胖子不能爱 提交于 2019-12-13 02:55:24
问题 i have passed through this post and i noticed that in Clifford's answer he said that we shouldn't use mutex in an interrupt, i know that in an interrupt we have to avoid too much instructions and delays ext... but am not very clear about the reasons could anyone clarify me for which reason we have to avoid this? In case that we want establish a synchronous communication between 2 interrupt driven threads what are the other mecahnism to use if using mutex is not allowed? 回答1: The original