microcontroller

How to write to flash memory using inline assembly?

隐身守侯 提交于 2019-12-11 04:00:01
问题 I am using MPLAB C18 compiler with PIC18F87J11 and I am trying to save some values to flash memory, using inline assembly, which is a combination of C and assembly code. It looks like I can write and read to flash memory correctly, but as soon as I power cycle my PIC and then attempt to read what I previous saved from a specific address, I don't get the same value. I am saving 0x09 to 0xB22A address. Like I said, if I save the value then read it immediately, everything comes up correctly, but

Why does this state machine not maintain its state?

不问归期 提交于 2019-12-11 03:54:12
问题 Hey there StackOverflow! In the following code I have a simple state machine that changes the operation of some external lighting device (as the comments imply). The state is changed via the pressing of the button connected to GP1. The circuit connected to GP1 is a comparator debouncing circuit that compares VDD to 0.6VDD (I've also tried an RC/diode/schmitt trigger circuit), which then forces the signal LO. On a scope, we see a clean square wave when the button is actuated rapidly. The

How is ISR a callback function

蹲街弑〆低调 提交于 2019-12-11 03:49:00
问题 The wikipedia entry states: In computer system programming, an interrupt handler, also known as an interrupt service routine or ISR, is a callback function in microcontroller firmware, an operating system or a device driver, whose execution is triggered by the reception of an interrupt. How is ISR a callback. Is it the PC value stored on stack itself is the callback function? I.e., the ISR calls the interrupted function back. Hence the interrupted function is a callback. 回答1: A bit of setup

What does “ENTRY” mean in a linker script?

一个人想着一个人 提交于 2019-12-11 01:24:12
问题 I am beginning to learn to write some low-level software for micro-controllers, and I've started studying linker scripts. I don't really get the meaning of the ENTRY command in this context. Since most micro-controllers start execution at a predetermined address, what difference does it make which entry point we choose in the linker script? 回答1: ENTRY() is an ELF feature that basically just sets the program entry address in the ELF header of your executable. This address may differ from the

identifying the DTMF tones in android

风流意气都作罢 提交于 2019-12-10 21:43:07
问题 I m planning to create a centrex system app in android. In which there is a voice mail will set in the receiver side. By the instructions in the voice mail, caller has to press the number in the dial pad, receiver side should identify the number and do the corresponding actions. Does anyone have any idea about how to detect the number pressed by the caller in receiver side?, What is the technology behind it?, Is it possible in android? Any help will be appreciable.. 回答1: Decoding DTMF is

How to make data bank size more than 256 bytes [Linker File - MPLAB ]

放肆的年华 提交于 2019-12-10 18:03:57
问题 I have PIC18F87J11 FAMILY and I am using MPLAB C18 Compiler. What is the maximum bytes I can give the following variable. I know that I have to modify the linker file to achive more than 256 bytes. #pragma udata CONNECTION_TABLE This is my clean linker file. // File: 18f87j11_g.lkr // Generic linker script for the PIC18F87J11 processor #DEFINE _CODEEND _DEBUGCODESTART - 1 #DEFINE _CEND _CODEEND + _DEBUGCODELEN #DEFINE _DATAEND _DEBUGDATASTART - 1 #DEFINE _DEND _DATAEND + _DEBUGDATALEN LIBPATH

USB Driver Installation Issue for Microcontroller using Custom INF

断了今生、忘了曾经 提交于 2019-12-10 10:17:06
问题 I'm working with the NXP LPC1788 microcontroller and I'm trying to create a driver on the host computer to communicate with it via USB. I believe that I've managed to get the device handling standard USB requests properly (the PC is able to read the string descriptors properly). I'm having trouble writing a sample USB driver and installing it for the device, though. I'm working with Microsoft Visual Studio 2013. My steps were: Creating a WinUSB Application, which produces a "Driver" and

Faster 16bit multiplication algorithm for 8-bit MCU

偶尔善良 提交于 2019-12-09 07:51:35
问题 I'm searching for an algorithm to multiply two integer numbers that is better than the one below. Do you have a good idea about that? (The MCU - AT Tiny 84/85 or similar - where this code runs has no mul/div operator) uint16_t umul16_(uint16_t a, uint16_t b) { uint16_t res=0; while (b) { if ( (b & 1) ) res+=a; b>>=1; a+=a; } return res; } This algorithm, when compiled for AT Tiny 85/84 using the avr-gcc compiler, is almost identical to the algorithm __mulhi3 the avr-gcc generates. avr-gcc

How hard is it for a software developer to learn how to program a microcontroller?

柔情痞子 提交于 2019-12-09 04:13:23
问题 I'm a software developer. I've been programming in high level languages for a few years. I would like to know, how to take my first step into programming hardware. Not something crazy complicated, but maybe some ordinary CE device? Assuming I don't need to put the PCB together with varies components, but just to program the tiny cpu? How low-level do I have to go? ASM? C? manipulating registers? or are the dev kit quite high level now? Is Java even in the picture? OO coding in hardware, is

starting a microcontroller simulator/emulator

别等时光非礼了梦想. 提交于 2019-12-09 00:10:13
问题 I would like to create/start a simulator for the following microcontroller board: http://www.sparkfun.com/commerce/product_info.php?products_id=707# The firmware is written in assembly so I'm looking for some pointers on how one would go about simulating the inputs that the hardware would receive and then the simulator would respond to the outputs from the firmware. (which would also require running the firmware in the simulated environment). Any pointers on how to start? Thanks Chris 回答1: