Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help for ASM code - soft serial project 115200 bauds
28-08-2014, 02:23 PM,
#1
Help for ASM code - soft serial project 115200 bauds
I would like to replace ces 2 C-coded statements by asm code :
SW_PORT_TXDpin= (uartdata>>i) & 0x01;

uartdata = uartdata | (SW_PORT_RXDpin<<i);

SW_PORT_TXDpin is PORTBbits.RB4
SW_PORT_RXDpin is PORTBbits.RB5

I find the asm code built by SDCC really is too long. Furthermore I have to obtain very accurate processing time.

Thanks for your proposals.
André
Reply
28-08-2014, 02:41 PM,
#2
RE: Help for ASM code - soft serial project 115200 bauds
Hi

I think you're asking for something impossible.
The software UART can be done for low baud rate but not for 115200baud which have a timing of 8,6805555uS
Pic32 have a clock of 80MHz (0,125uS) you have 69,4444444 clock cycles to manage a full duplex communication, too low time.
In any case your baud rate is no standard and go from 115942 to 114285 (69 or 70 clock cycles)


Bye Bye, Moreno
Reply
28-08-2014, 05:43 PM, (This post was last modified: 28-08-2014, 05:46 PM by gtcbreizh.)
#3
RE: Help for ASM code - soft serial project 115200 bauds
Hi Moreno,
I attach a test program with a baudrate = 115200, test done under MPLAB C18 and using the lib SWUART from the package MPLAB
It is very basic but it works !
I recognize it's a bit risky for a real professional application.
57600 bauds already satisfy me. I continue to test.
Bye, André


Attached Files
.c   main.c (Size: 2.11 KB / Downloads: 3)
Reply
28-08-2014, 06:57 PM,
#4
RE: Help for ASM code - soft serial project 115200 bauds
Hi

Yes with MPlab your program can work because all interrupts are disabled and the processor spend 100% of the time on your program.
With PINGUINO the situation is quite different, there are some interrupts active, first of all. the timer interrupt.
Program have the lowest priority and these interrupts can alter the timing of the baud rate.


Bye Bye, Moreno
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)