microchip

Remake of Fletcher checksum from 32bit to 8

拜拜、爱过 提交于 2019-12-22 12:36:41
问题 Is this conversion right from the original? uint8_t fletcher8( uint8_t *data, uint8_t len ) { uint8_t sum1 = 0xff, sum2 = 0xff; while (len) { unsigned tlen = len > 360 ? 360 : len; len -= tlen; do { sum1 += *data++; sum2 += sum1; tlen -= sizeof( uint8_t ); } while (tlen); sum1 = (sum1 & 0xff) + (sum1 >> 4); sum2 = (sum2 & 0xff) + (sum2 >> 4); } /* Second reduction step to reduce sums to 4 bits */ sum1 = (sum1 & 0xff) + (sum1 >> 4); sum2 = (sum2 & 0xff) + (sum2 >> 4); return sum2 << 4 | sum1;

cdc_acm : failed to set dtr/rts - can not communicate with usb cdc device

↘锁芯ラ 提交于 2019-12-21 04:49:11
问题 I was trying to enumerate usb cdc device using pic24fj128gb206. Device seems to be enumerated properly. But when I connect my device to Linux PC, I am getting the below warning message from kernel. cdc_acm 1-8.1.6.7:1.0: failed to set dtr/rts And this message will repeat when I try to connect using screen. screen /dev/ttyACM9 115200 And I am not able to communicate with my device from PC [ Ubuntu, 14.04 ] When analysing the data using wireshark, it looks like USB communication is fine until,

Whats the best resource to learn Assembly language for PIC microcontroller's [closed]

牧云@^-^@ 提交于 2019-12-20 23:27:01
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 8 years ago . I'm going to start working on a project where I need to have a decent understanding of Assembly language for the PIC microcontroller's

What is the best c compiler for the Pic18 micro [closed]

我的梦境 提交于 2019-12-20 12:33:48
问题 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 . We are starting a new project based a microchip PIC18F252. What is the best 'c' compiler to use? 回答1: tech PICC has always been reliable for me and it has had many years of development. 回答2: Microchip C18 compiler: really the best and easiest to use. Perfect for professional

Convert ASM to C (not reverse engineer)

对着背影说爱祢 提交于 2019-12-17 10:39:07
问题 I googled and I see a surprising amount of flippant responses basically laughing at the asker for asking such a question. Microchip provides some source code for free (I don't want to post it here in case that's a no-no. Basically, google AN937, click the first link and there's a link for "source code" and its a zipped file). Its in ASM and when I look at it I start to go cross-eyed. I'd like to convert it to something resembling a c type language so that I can follow along. Because lines

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

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

How can I write hardware independent functions in C for the PIC24

烂漫一生 提交于 2019-12-12 20:09:10
问题 I am working on some code that impliments various features such as a PID controller, signal generator, etc. My hardware provides various inputs and outputs. Just now I have a load of SWITCH statement to determine the source and destination of my calculations. For example for the PID controller, there is a switch command every 100ms that decides which input to pass to the pid_calculate function, followed by another switch to decide what to do with the return value. As I have 32 analog inputs,

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

dsPic33E : RS485 Communication issue

断了今生、忘了曾经 提交于 2019-12-11 08:02:00
问题 I am facing issue while communicating serially over RS485 port. I am using dsPic33E microcontroller with Max485. using breakpoint i analyzed that Whenever I send "0x00" to controller, "0xFF" is received. Then I sent "0x01" , "0xFD" is received on controller.and so on. Also i tried to use loop-back logic, means sending back the received character, but every time I receive "0x00" for any value sent. I am unable to get the issue. below is the snapshot of the code I am using : // RS485 TRISBbits