embedded

Modbus stack for Microchip PIC

有些话、适合烂在心里 提交于 2019-11-30 20:35:28
Can someone suggest an open source implementation of a Modbus RTU Slave for a Microchip PIC18 processor? I'm looking for an implementation of Modbus RTU for RS-232/RS-485, but a Modbus TCP/IP implementation would be welcome as well. I've implemented a Modbus RTU (and ASCII) slave for PIC18 but using USB instead of RS232/485. It would be very easy to convert to RS232/485 though as the protocol code only requires character transmit and receive functions. I can help you with this if required. Take a look at my USB Modbus I/O page at http://www.fieldofcows.com/index.php?title=USB_Modbus_Interface

what dbus performance issue could prevent it from embedded system?

﹥>﹥吖頭↗ 提交于 2019-11-30 20:04:48
From my reading dbus performance should be twice slower than other messaging ipc mechanisms due to existence of a daemon. In the discussion of the so question which Linux IPC technique to use someones mention performance issues. Do you see performance issues other than the twice slower factor? Do you see the issue that prevent dbus from being used in embedded system? To my understanding if dbus is intended for small messages. If large amount of data need to be passed around, one of the solution is to put the data into shared memory or a pile, and then use dbus to notify. Other ipc mechanisms

how to rebuild rootfs in buildroot

醉酒当歌 提交于 2019-11-30 20:01:18
I am going to setup build environment to make my own linux embedded system for AT91SAM9X25 Board. I am using buildroot to do this. The make command build all targets, the first it build toolchain then packages and then rootfs and images of rootfs (tar, cpio ...). To rebuild rootfs I usually use make clean and then make. The make clean command removes all and including toolchain. So the first my question is: Is there some way to remake rootfs without building toolchain? It takes a lot of time. Also I am building linux kernel within buildroot. I have turned on BR2_LINUX_KERNEL [=y] in buildroot.

Converting to ASCII in C

你。 提交于 2019-11-30 19:45:45
Using a microcontroller (PIC18F4580), I need to collect data and send it to an SD card for later analysis. The data it collects will have values between 0 and 1023, or 0x0 and 0x3FF. So what I need to do is convert 1023 into a base 10 string of literal ASCII values (0x31, 0x30, 0x32, 0x33, ...). My problem is that the only way I can think of to split the digits apart requires a lot of division. char temp[4]; temp[0] = 1023 % 10; temp[1] = (1023 % 100) / 10; temp[2] = (1023 % 1000) / 100; temp[3] = (1023 % 10000) / 1000; Using this method, finding the ASCII values of an n digit decimal number

Qt Embedded 键盘驱动分析(上)

流过昼夜 提交于 2019-11-30 19:34:26
为了保持QtEmbedded对硬件最小化的依赖程度,QtEmbedded所有硬件相关的操作都采用插件的封装形式,并且大部分功能都可以从程序外部运用环境变量的方式来配置。这样一来我们只要针对不同的硬件写好不同的插件,为不同硬件平台提供不同的启动脚本就可以了,换了硬件,代码却不需要修改。 Qt Embedded的键盘操作是这种插件封装形式的典范,我们就以此为例,对Qt Embedded的硬件操作一窥究竟。 1、告诉QtEmbedded你需要哪个驱动 QWS_KEYBOARD这个环境变量就是你需要了解的全部。 设置该变量的方法为在运行QtE server程序之前用下面的命令设置: export QWS_KEYBOARD= <driver>[:<driver specific options>] driver参数即驱动的类型, 如“usb”、“tty”等, 在下篇中我们再详细讨论这个。 options则指定硬件设备名, 如/dev/input/event0, 这个参数就要按你的硬件实际情况来提供了。 2、载入用户需要的驱动插件 这个环境变量是如何工作的呢? 今天我们讲述的重点放在QtE的几个文件上: 读取环境变量, 载入相应的键盘驱动插件:src/gui/embedded/qwindowsystem_qws.cpp 创建键盘处理函数类的实例:src/gui/embedded

Trigonometric functions on embedded system

断了今生、忘了曾经 提交于 2019-11-30 19:05:05
sin and cos functions are slow and need a lot of resources to run on embedded systems. How does one calculate sin and cos functions in a more resource-saving and faster way? pavium To calculate a Taylor or Fourier series is always going to be time-consuming. In an embedded system, you should think about lookup tables . There might also be interesting information on the 'Net about how Hewlett-Packard optimised such calculations in their early scientific calculators. I recall seeing such stuff at the time Noldorin A lookup table with interpolation would without doubt be the most efficient

Using boost in embedded system with memory limitation

久未见 提交于 2019-11-30 19:00:38
We are using c++ to develop an application that runs in Windows CE 4 on an embedded system. One of our constraint is that all the memory used by the application shall be allocated during startup only . We wrote a lot of containers and algorithms that are using only preallocated memory instead of allocating new one. Do you think it is possible for us to use the boost libraries instead of our own containers in these conditions? Any comments and/or advice are welcomed! Thanks a lot, Nic You could write your own allocator for the container, which allocates from a fixed size static buffer.

Why shouldn't we have dynamic allocated memory with different size in embedded system

半世苍凉 提交于 2019-11-30 18:53:52
问题 I have heard in embedded system, we should use some preallocated fixed-size memory chunks(like buddy memory system?). Could somebody give me a detailed explanation why? Thanks, 回答1: In embedded systems you have very limited memory. Therefore, if you occasionally lose only one byte of memory (because you allocate it , but you dont free it), this will eat up the system memory pretty quickly (1 GByte of RAM, with a leak rate of 1/hour will take its time. If you have 4kB RAM, not as long)

How to print floating point value using putchar?

旧巷老猫 提交于 2019-11-30 18:32:27
问题 I am working on an embedded application and need to print floating point values. Due to space and other limitations I can only use putchar() for output. I am trying to create a function that takes a float as parameter and prints it using putchar(). I have a similar function that works for integer values. void putLong(long x) { if(x < 0) { putchar('-'); x = -x; } if (x >= 10) { putLong(x / 10); } putchar(x % 10+'0'); } How could I make a similar function for floats? 回答1: Here's a possible

Is there a standalone implementation of std::function?

。_饼干妹妹 提交于 2019-11-30 17:53:52
I'm working on an embedded system, so code size is an issue. Using the standard library ups my binary size by about 60k, from 40k to 100k. I'd like to use std::function, but I can't justify it for 60k. Is there a standalone implementation that I can use, or something similar? I'm using it to implicitly cast lambdas in member functions with bound variables in c++ 11. Here is simple implementation of std::function-like class template without inclusion of any headers. You can customize the behavior as you wish(like move/forward, empty call response, etc): live_demo // Scroll down for example of