Page 1 of 1

Dspic30f4013

Posted: Mon Aug 05, 2019 3:04 am
by claudemir
Oi
Preciso de mais uma ajuda, agora é com o dspic30f4013, uso a versão 7 para tentar programar o mesmo, comecei com fazer o led piscar num intervalo de tempo de um segundo, utilizando um oscilador externo de 12mhz e configurado para HS/2W/PLL4x, compila normalmente e sem erros, mas o difícil é que não consigo sequer acender o led, na simulação funciona tudo normalmente.
É a primeira vez que programo esse micro processador, comprei via aliexpress um kit com 10 unidades, já troquei 3 pensando que havia queimado.
Nunca apanhei tanto para acender um led.
Por favor me explica o que estou fazendo de errado.

Re: Dspic30f4013

Posted: Wed Aug 07, 2019 12:30 am
by claudemir
Good evening everyone
I solved my problem with 30f4013, believe me soi pickit3 was doing something wrong, maybe not writing the .hex correctly.
I solved this problem but I waited next, added an RS232 port, and enabled rxINIT1, the program goes into infinite loop, as would be receiving data in RX, already disconnected the RX TX port, but the problem is only solved when I disable rxINIT1. Has anyone had a similar problem?

Re: Dspic30f4013

Posted: Wed Aug 07, 2019 10:21 am
by Benj
Hello,

Can we see your program to make sure that's not doing something strange in the interrupt and causing the lockup?

Re: Dspic30f4013

Posted: Sun Aug 11, 2019 4:24 pm
by claudemir
Hello benj
Thanks for answering,
In the previous post I complained about RXINIT that was supposed to be in constant loop, but I solved what I imagined was a problem creating a new project, I didn't find what I was wrong but now RXINIT is ok. Now I'm having trouble receiving a string, in 18f works perfectly, I changed to input a byte array to convert to a string, but also can not display in the display, the simulation is perfect. When working with receive string, in the end I get character "0" identifying the end of the receive string to leave the receive loop, but I also do not receive this character to the end of the array, put a led to identify when it enters the routine of RX, for TX everything is normal in send the string.

Re: Dspic30f4013

Posted: Mon Aug 12, 2019 12:19 pm
by Benj
Hello,

You're doing quite a lot in your interrupt macro. Ideally this should just pull in a single received byte and add this to a buffer to be processed later.

Here's how I might do it, note the sender would have to add a "\n" carriage return to the end of each section of data.
Demo.fcfx
(15.76 KiB) Downloaded 254 times

Re: Dspic30f4013

Posted: Tue Aug 13, 2019 1:03 am
by claudemir
Good night Benj
I used your program to test my pic, even adding "\ n" at the end of each string sent to pic just printed as attachment.
I also changed return type to 16bit RS232 module, printed "yx" and send the string "test"

Re: Dspic30f4013

Posted: Tue Aug 13, 2019 12:36 pm
by Benj
Hello,
I used your program to test my pic, even adding "\ n" at the end of each string sent to pic just printed as attachment.
For the program to work you need to add "\n" no space between the slash and the n. This is an escape sequence carriage return. i.e. ASCII 10.

You could change the program so it instead looks for another delimiter e.g. a semicolon or a full stop.