microcontroller

Reading state of input pins on a PIC18

南楼画角 提交于 2020-01-02 09:43:32
问题 I have been able to get outputs working on my PIC and can make a bunch of LEDs dance on and off as I set various output latches high/low. However, I'm having a lot o difficulty reading in the state of a pin. See the code below. I set up my config, and define the TRISC as input and TRISB as output. In an infinite loop, I check to see whether RC6 is high or low, and set the entire B latch high or low depending on the result. #include <htc.h> __CONFIG(1, FOSC_IRC & FCMEN_OFF & IESO_OFF); _

AVRISPmkII connection status: Unknown status 0x00

末鹿安然 提交于 2020-01-02 02:51:10
问题 Well.. I've been searching on the web in many corners.. but I could not find a solution to my problem. Last time I used my AVRISP2 it worked fine. Now I get the following message when I try to write my program on the uC: avrdude: stk500v2_command(): command failed avrdude: stk500v2_program_enable(): bad AVRISPmkII connection status: Unknown status 0x00 avrdude: initialization failed, rc=-1 Double check connections and try again, or use -F to override this check. I found many posts on the

Quantifiable differences between RTOS kernels for small ARM microcontrollers [closed]

回眸只為那壹抹淺笑 提交于 2020-01-01 17:19:07
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 5 years ago . There are many different RTOS available for microcontrollers. I am specifically looking for RTOS that support the ARM Cortex M processors. Also, I am not interested in closed source solutions. Attempting to compare the relative merits of each RTOS from websites and mailing

How to Convert pythons Decimal() type into an INT and exponent

…衆ロ難τιáo~ 提交于 2020-01-01 08:38:09
问题 I would like to use the Decimal() data type in python and convert it to an integer and exponent so I can send that data to a microcontroller/plc with full precision and decimal control. https://docs.python.org/2/library/decimal.html I have got it to work, but it is hackish; does anyone know a better way? If not what path would I take to write a lower level "as_int()" function myself? Example code: from decimal import * d=Decimal('3.14159') t=d.as_tuple() if t[0] == 0: sign=1 else: sign=-1

How can you do C++ when your embedded compiler doesn't have operator new or STL support?

≯℡__Kan透↙ 提交于 2020-01-01 05:35:09
问题 I am working on a group senior project for my university and I have run into a major hurdle in trying to get my code to work. The compiler that we have for our 8 bit Atmel microcontroller does not support the new or delete operators, and it does not support the C++ STL. I could program it in C, but I have to implement an A* algorithm which I have never done before. While I have tried C initially I soon realized that I never did pure C before. Trying to model objects with structs and functions

Questions about displaying 0x00 to 0xFF with two seven segment Lights

随声附和 提交于 2019-12-25 18:48:16
问题 Can someone please help me with this? I have been researching and trying to get this working, but I'm out of luck. All the codes I found online were not working... The output, for now, is 00, 11, 22, 33, ... FF and lop back to 00. How do I separate the first and second digit displays? Like I want it to display from 0 to 255 (00, 01, 02...FF)? Requirements: When the circuit is first energized, the seven-segment LEDs will start counting at 0x00. The duel segment LEDs will count up to 0xFF,

How to convert an integer array to a string without the use of a library [closed]

被刻印的时光 ゝ 提交于 2019-12-25 16:54:33
问题 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 2 years ago . So I am working on an internship project. I have to develop a whole system that will gather some data and will then send it through to a server. The system consist of an MSP430G2553 microcontroller so I am coding in pure C without any library's, so no sprintf or malloc functions I

I2C addresses > 63 are not usable with atTiny85

时光怂恿深爱的人放手 提交于 2019-12-25 04:37:52
问题 Hi I have a big problem with addressing multiple attiny85-chips with I2C: For what I know the attiny uses 7-bit addresses for communication. I am using the TinyWireS lib, which works perfectly fine for me, untill I am reaching address: '64' which is '1000000' in binary. The highest usable address should be '1111111'. This is what happens: Slave: Attiny85: switches led on or off when msg is received over I2C. Slaveaddress: 64 #include <TinyWireS.h> #include <usiTwiSlave.h> #define output (4)

PIC - is there a value for RB7?

爱⌒轻易说出口 提交于 2019-12-25 04:32:20
问题 I read the port RB7, and in the if a check the value. if there is output on RB7 I want that the led on my chip light up (led D1), but it burns all the time even when there is nothing connected to RB7. What i'm doing wrong? That's the PIC 18F4550 It's written in mplab v8.63 and the C18 compiler. void main (void) { TRISD = 0x00; // PORTD als uitgang TRISB = 0b00110000; // RB4 en RB5 als ingang RCONbits.IPEN = 0; // prioriteit uit INTCONbits.GIE = 1; // enable interrupt INTCONbits.RBIE = 1; //

extrange behavior of serial port using Qt

落花浮王杯 提交于 2019-12-25 02:58:06
问题 I am performing an app with QT for communicate my PC with an 8 bits microcontroller through rs-232. I am using the QtSerialPort library and the communication is working fine, but each time I write something from the PC to the micro and I receive the response, I have to close and open the serial port or I can't continue communicating.. My configuration is: 10500 bps, 8 bits, 1 stop, no parity, no flow control. The code used for the configuration and the lecture/writting of the port is the next