microcontroller

Display previously received UART values

夙愿已清 提交于 2019-12-13 17:22:31
问题 This should be easy to answer to anyone familiar with C. I want to display the previous values of a variable (receive register of a UART (RS-232) on a microcontroller) on an LCD. This is my current implementation and it works ok. But I'd like to know if there is a way to spend less time in my interrupt routine. Currently, the peripheral is configured to jump to the interrupt routine as soon as it receives one new character in the UART feed. Suggestions anyone? //Initialization char U1RX_data

Sending (serial) break using windows (XP+) api

送分小仙女□ 提交于 2019-12-13 14:32:41
问题 Is there a better way to send a serial break then the setcommbreak - delay - clearcommbreak sequence? I have to communicate with a microcontroller that uses serial break as the start of a packet on 115k2, and the setcommbreak has two problems: with 115k2, the break is well below 1ms, and it will get timing critical. Since the break must be embedded in the packet stream at the correct position, I expect trouble with the fifo. Is there a better way of doing this, without moving the serial

Fast interpreted language for memory constrained microcontroller

☆樱花仙子☆ 提交于 2019-12-13 13:42:12
问题 I'm looking for a fast interpreted language for a microcontroller. The requirements are: should be fast (not crucial but would be nice) should be light on data memory (small overhead <8KB, excludes program variable space) preferably would be small in program size and the language would be compact preferably, human readable (for example, BASIC) Thanks! 回答1: Some AVR interpreters: http://www.cqham.ru/tbcgroup/index_eng.htm http://www.jcwolfram.de/projekte/avr/chipbasic2/main.php http://www

Where can I find soft-multiply and divide algorithms?

点点圈 提交于 2019-12-13 11:55:01
问题 I'm working on a micro-controller without hardware multiply and divide. I need to cook up software algorithms for these basic operations that are a nice balance of compact size and efficiency. My C compiler port will employ these algos, not the the C developers themselves. My google-fu is so far turning up mostly noise on this topic. Can anyone point me to something informative? I can use add/sub and shift instructions. Table lookup based algos might also work for me, but I'm a bit worried

How to illustrate an interrupt-driven process?

谁说胖子不能爱 提交于 2019-12-13 11:42:27
问题 This question is related to diagraming a software process. As an electrical engineer, much of the software I do is for embedded micro-controllers. In school, we learned to illustrate our algorithm using a flowchart. However, nowadays, many of my embedded projects are heavily interrupt-driven where the main process runs some basic algorithm a variety of interrupt sources provide its stimulus. So, my question is, what are some diagramming techniques that I can use to illustrate my process such

String to double function returning infinity result in embedded compiler

ε祈祈猫儿з 提交于 2019-12-13 10:02:33
问题 I'm trying to perform string to double conversion. In gnu c compiler I'm getting correct values. But if I use it in my embedded compiler (renesas CS+) it is giving undefined behavior like returning infinity result. Here is my code: double str_to_double_func(char a[]) { char str[30] = {'0'}; int loop ; double result; int len ; int pos,n; for(loop = 0;a[loop]!='\0';loop++) { str[loop] = a[loop]; } str[loop] = '\0'; pos = 0; len = sizeof(str)-1; for (n = 0; n < len; n++) { if (str[n] == '.') {

Volatile keyword in microcontrollers [closed]

微笑、不失礼 提交于 2019-12-13 09:53:48
问题 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 4 years ago . The volatile keyword tells the compiler not to optimize the variable which is prefixed. The variable may change during run time by unknown source (not known by the compiler) maybe by an external interrupt etc. Is there any other advantage of volatile ? Does volatile apply to

How to store values in an array to a variable on MPLAB?

时光怂恿深爱的人放手 提交于 2019-12-13 06:22:23
问题 The following code works fine on CodeBlocks compiler but on MPLAB C18 compiler I don't get the same results. I am using PIC18 microcontroller. Code int d[6]; int all; d[0] = 6; d[1] = 4; d[2] = 8; d[3] = 0; d[4] = 0; all = 10000*d[0] + 1000*d[1] + 100*d[2] + 10*d[3] + d[4]; printf("%d", all); Output on CodeBlocks : 64800 Output on MPLAB : -816 What is exactly the problem? Shouldn't this code work fine? Thanks! 回答1: Objects that have the type int aren't guaranteed to be able to store values

Problems opening and closing the mscomm port in vb6 when interfacing microcontroller

核能气质少年 提交于 2019-12-13 06:01:53
问题 the code is to get data from a microcontroller or any device from serial device using serial port,so i am having problem with port opening and getting data,am having this problem for last 20 days please kindly help me at the earliest :) Private Sub Command1_Click() MsgBox ("The port is open " & MSComm1.PortOpen) If (MSComm1.PortOpen = False) Then MSComm1.PortOpen = True End If Command1.Enabled = False Command2.Enabled = True End Sub Private Sub Command2_Click() If (MSComm1.PortOpen = True)

Which is the best way to parse a file containing Assembly language using Java.?

若如初见. 提交于 2019-12-13 05:15:47
问题 I have read about StringTokenizer , StreamTokenizer , Scanner , Pattern and Matcher from the java.util.regex package. I have also read about opinions on them and I am realy confused: which one is the best to use? What I need to do is to make an Assambler, that is, to parse a file containing Assembly language from that file and I need to transform it into Machine Code. For example if I have the assembly code: MOV R15,R12 This should translate to hexa numbers coresponding to each instruction