microcontroller

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

Counting without “counter” in microcontroller is Possible?

和自甴很熟 提交于 2019-12-13 04:35:40
问题 Hello friends i am new in microcontroller domain wants to know is this not possible to counts an events without using counter i mean by monitoring the pin which is connected to the the event generator.i am asking this question because presently i want to calculate the frequency of sensor i have already checked it frequency by using DSO(Digital storage oscilloscope) and it(DSO) says its frequency is 98khz but as we all now that the maximum value of an 8 bit counter is 255 then how it is

sprintf corrupting arrays in IAR microcontroller

不羁的心 提交于 2019-12-13 01:26:36
问题 I am currently learning embedded programming, and thus working on an IAR-platform using a TI microcontroller with ARM architecture. Since I am not at all familiar with the technicalities related to this kind of programming, or C programming in general, I would like to ask a basic question: I have the following simple code snippet: int i; for(i = 0; i < NUM_SAMPLES; i++) { sinTable[i] = sinf(2*i*dT*PI); } for(i = 0; i < NUM_SAMPLES; i++) { char out[32]; sprintf(out,"sin: %.7f, %.7f;", i*dT,

Writing to EEPROM on PIC

别说谁变了你拦得住时间么 提交于 2019-12-12 15:10:34
问题 Are there any PIC microcontroller programmers here? I'm learning some PIC microcontroller programming using a pickit2 and the 16F690 chip that came with it. I'm working through trying out the various facilities at the moment. I can sucessfully read a byte from the EEPROM in code if I set the EEPROM vaklue in MPLAB but I don't seem to be able to modify the value using the PIC itsself. Simply nothing happens and I don't read back the modified value, I always get the original which implies to me

How generate REAL random number using STM32 MCU?

故事扮演 提交于 2019-12-12 11:13:43
问题 I'm working on a project with STM32F103E arm cortex-m3 MCU in keil microvision IDE. I need to generate random numbers for some purposes, but I don't want to use pseudo-random numbers which standard c++ libraries are generating, so I need a way to generate REAL random numbers using hardware features, but I don't know how I can do it. Any idea? (I'm a software engineer & not an electronic professional, so please describe it simple :P) 回答1: As pointed out, the chip does not have a hardware RNG.

NAND flash programming: granularity of writes?

╄→尐↘猪︶ㄣ 提交于 2019-12-12 10:13:17
问题 is someone in the kow about write accesses on nowadays large NAND flash chips? What is the minimal granularity for writes? I have a microcontroller flash here which requires at least 1 and at most 4 words (16-bit words that is) to be fed to the write statemachine at once. I think that the large (> 1 Gbit) flashes behave differently here for write performance reasons. slarti 回答1: So to be clear, to write a 1 bit you have to clear a whole block of memory, to write a 0 bit you only have to write

How to scale a number/range of numbers in c

∥☆過路亽.° 提交于 2019-12-12 05:09:29
问题 I want to be able to display the altitude in ft ranging from 0ft to 20000ft on my LCD module. The numbers are read from a potentiometer that I can rotate to change the values. At the moment the potentiometer displays from 0 to 1023 but I need to scale these appropriately so they read from 0-20000ft. As well as this I want the line below to display a 'bar graph' to represent the altitude increasing. The LCD has 20 blocks per line so the bar graph can range from 1 block to 20 blocks. sprintf

UART register is not debugging to terminal

和自甴很熟 提交于 2019-12-12 04:59:04
问题 This is a UART transfer between two atmega328p controllers. I am trying to confirm that the data is being properly passed by printing a variable from the data struct on the receiving controller. My terminal is not displaying any information. I can only confirm that the code is being reached from my LED calls, where I enable portB. I am fairly sure my BAUD rate is correct (51 for 8mhz). Also confident the hardware is hooked up properly. Any recommendations on how to debug further to find the

Microcontroller and flash memory chip programming development and simulation

一个人想着一个人 提交于 2019-12-12 03:30:08
问题 I just started to learn micro-controller programming and I seem to have a lot of trouble getting started, particularly the simulation part. This is an application I need to program: I need to store a few wave files in a flash memory chip, and use a Cortex-M0 to read in the music from the flash memory, and play them in combination, or run some basic signal processing on them. I am looking for an IDE that supports the end-to-end simulation on this. I looked at CoIDE (because if I google free

Stm32f4: DMA + ADC Transfer pausing

半世苍凉 提交于 2019-12-12 02:43:00
问题 On the Stm32f4-Discovery board I've configured the tripple ADC Interleaved mode with DMA writing the ADC data in circular mode 2. Everything works fine, but I can't pause the transfer properly to transfer the data in the buffer through USART (the transform is performed inside an external interrupt vertor function). I am trying to implement such an algorithm: Initialize DMA and ADCs Wait for an external interrupt Pause the DMA transfer Send the buffered data through USART Resume the DMA