dspic

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

How to rotate the bits in a word

最后都变了- 提交于 2019-12-02 03:33:18
问题 I'm using a dsPIC33F and GCC. I want to rotate the bits in a word once left or right, like this: MSB LSB input: 0101 1101 0101 1101 right: 1010 1110 1010 1110 left : 1011 1010 1011 1010 (In case it's not clear, the LSB moves into the MSB's position for the right rotate and vice versa.) My processor already has a rotate right (rrnc, rrc) and rotate left instruction (rlnc, rlc), so I'm hoping the compiler will optimise this in. If not, I might have to use inline assembly. 回答1: You may write