Dspic30f4013

An area to discuss 16-bit PIC specific problems and examples

Moderator: Benj

Post Reply
claudemir
Posts: 58
Joined: Sat Nov 03, 2012 7:43 am
Has thanked: 12 times
Been thanked: 5 times

Dspic30f4013

Post 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.

claudemir
Posts: 58
Joined: Sat Nov 03, 2012 7:43 am
Has thanked: 12 times
Been thanked: 5 times

Re: Dspic30f4013

Post 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?

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Dspic30f4013

Post by Benj »

Hello,

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

claudemir
Posts: 58
Joined: Sat Nov 03, 2012 7:43 am
Has thanked: 12 times
Been thanked: 5 times

Re: Dspic30f4013

Post 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.
Attachments
Receive string from TX
Receive string from TX
Receive tx.JPG (46.01 KiB) Viewed 8329 times
Does not print string
Does not print string
20190811_114434.jpg (68.8 KiB) Viewed 8329 times
Flowcode1.fcfx
(17.46 KiB) Downloaded 279 times

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Dspic30f4013

Post 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 291 times

claudemir
Posts: 58
Joined: Sat Nov 03, 2012 7:43 am
Has thanked: 12 times
Been thanked: 5 times

Re: Dspic30f4013

Post 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"
Attachments
20190812_205316.jpg
(64.92 KiB) Downloaded 1581 times

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Dspic30f4013

Post 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.

Post Reply