Pic12f683 - rs232 FL8 in target do not work
Moderator: Benj
Re: Pic12f683 - rs232 FL8 in target do not work
Hi Martin,
Perfect!
Problem solved!
Thank you very much for supporting me in this work that was going to exasperate me. Now I can continue with the development of the rest of the firmware.
I saw how you modified the program. Small trick to solve a problem that seemed insurmountable, I honestly do not understand why it is necessary but for now it is enough for me. I'll think about it later.
Regards
castabob
Perfect!
Problem solved!
Thank you very much for supporting me in this work that was going to exasperate me. Now I can continue with the development of the rest of the firmware.
I saw how you modified the program. Small trick to solve a problem that seemed insurmountable, I honestly do not understand why it is necessary but for now it is enough for me. I'll think about it later.
Regards
castabob
-
- Matrix Staff
- Posts: 9521
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
Re: Pic12f683 - rs232 FL8 in target do not work
Good, glad your problem is solved.
I can explain the reason behind it.
I have made a few small changes, which change are you referring to?castabob wrote:Small trick to solve a problem that seemed insurmountable, I honestly do not understand why it is necessary
I can explain the reason behind it.
Martin
Re: Pic12f683 - rs232 FL8 in target do not work
Hi Martin,
here is what is not entirely clear to me ...
first I had never used this method to intercept characters so when I used the usual system (the one you find in my first file sent) I was puzzled because in emulation it worked but not on the target.
Secondly I don't understand how you went from the first loop to the second loop without a specific instruction in the diagram.
Third I think I understand, (but I'm not sure) that the instruction added at the end of the recognition of the character received "Char_ricevuto = 255" is used for do not let the program interpret the same character for the second time (latency in the reception buffer?).
Sorry for my poor English that comes from my school reminiscences helped by google translator.
Regards
castabob
here is what is not entirely clear to me ...
first I had never used this method to intercept characters so when I used the usual system (the one you find in my first file sent) I was puzzled because in emulation it worked but not on the target.
Secondly I don't understand how you went from the first loop to the second loop without a specific instruction in the diagram.
Third I think I understand, (but I'm not sure) that the instruction added at the end of the recognition of the character received "Char_ricevuto = 255" is used for do not let the program interpret the same character for the second time (latency in the reception buffer?).
Sorry for my poor English that comes from my school reminiscences helped by google translator.
Regards
castabob
-
- Matrix Staff
- Posts: 9521
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
Re: Pic12f683 - rs232 FL8 in target do not work
Receiving transmitted will not work well(If at all) by just having RS232ReceiveChar within a loop.castabob wrote:first I had never used this method to intercept characters so when I used the usual system (the one you find in my first file sent) I was puzzled because in emulation it worked but not on the target.
What the chances of RS232ReceiveChar being accessed precisely on the start bit of the char being transmitted?
For that reason I placed the RS232ReceiveChar within the RS232 RX interrupt, so chars are not missed. As soon as RX line goes from +5V to 0V the RX interrupt is triggered and char is read.
It is genuinely bad programming practice to have go to's (Junction points) within code.castabob wrote:Secondly I don't understand how you went from the first loop to the second loop without a specific instruction in the diagram.
So I removed then and used a conditional loop instead that looks for a value at the end: What this means is look at the value of
Code: Select all
Abbandona_Loop
If its value is any value except zero then condition is true so exit loop.
If the value is zero then condition is false so so back to the start of the loop.
With a variable, if you don't have value e.g.
Code: Select all
Abbandona_Loop = 1
So the loop will exit if
Code: Select all
Abbandona_Loop = 1
Code: Select all
Abbandona_Loop = 2
Code: Select all
Abbandona_Loop = 3
Yes that is exactly it.castabob wrote:that the instruction added at the end of the recognition of the character received "Char_ricevuto = 255" is used for do not let the program interpret the same character for the second time (latency in the reception buffer?)
Char_ricevuto will be assigned a value depending on the value of transmitted char e.g.
Code: Select all
P = 80
Then the decision branch needs to be accessed only once.
Since the value assigned to Char_ricevuto will not change until the next char is received, it will stay at 80 and decision branch will keep getting accessed all the time.
To stop that, as soon as decision branch has been finished with, Char_ricevutohas been forced to 255 so the decision branches are no longer accessed.
Martin
Re: Pic12f683 - rs232 FL8 in target do not work
Hi,
ok it's clear to me.
Now it is also clear to me why in simulation it works: it is because the characters the simulator picks them up when they need them.
I didn't know that a loop could be conditioned. I'm not a very scrupulous student ...
Thank you very much, you have given an answer to all my questions and above all you have been able to make me understand what you have explained to me (it is not always easy to find teachers who know explain and make people understand).
Regards
castabob
ok it's clear to me.
Now it is also clear to me why in simulation it works: it is because the characters the simulator picks them up when they need them.
I didn't know that a loop could be conditioned. I'm not a very scrupulous student ...
Thank you very much, you have given an answer to all my questions and above all you have been able to make me understand what you have explained to me (it is not always easy to find teachers who know explain and make people understand).
Regards
castabob
-
- Matrix Staff
- Posts: 9521
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
Re: Pic12f683 - rs232 FL8 in target do not work
That's exactly it, the simulation will be much less fussy than actual hardware.castabob wrote:Now it is also clear to me why in simulation it works: it is because the characters the simulator picks them up when they need them.
In saying that the simulation is still great!
you just need to do a step at a time with hardware and make sure it works before carrying on.
You are welcome. I try and help when I can.castabob wrote:Thank you very much, you have given an answer to all my questions and above all you have been able to make me understand what you have explained to me (it is not always easy to find teachers who know explain and make people understand).
Good luck with your project.
Martin
-
- Valued Contributor
- Posts: 784
- Joined: Fri Jun 06, 2014 3:53 pm
- Has thanked: 186 times
- Been thanked: 205 times
Re: Pic12f683 - rs232 FL8 in target do not work
Hi Marinmedelec35 wrote:
I have thought of a way to simulate RX interrupt using Ben's excellent Is Sim function.
.
Where do I find this "Is Sim" function?
I'm obviously doing something stupid as I can't seem to find it anywhere.
Regards
-
- Matrix Staff
- Posts: 9521
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
Re: Pic12f683 - rs232 FL8 in target do not work
What I do to use Is Sim function:
Click on the magnifying glass (Search) enter issim (no space between Is & Sim).
You should then see the is sim component.
You can also see it within Matrix Tools by selecting Runtime (Cog icon) components.
Click on the magnifying glass (Search) enter issim (no space between Is & Sim).
You should then see the is sim component.
You can also see it within Matrix Tools by selecting Runtime (Cog icon) components.
Martin
-
- Valued Contributor
- Posts: 784
- Joined: Fri Jun 06, 2014 3:53 pm
- Has thanked: 186 times
- Been thanked: 205 times
Re: Pic12f683 - rs232 FL8 in target do not work
Hi
Is it part of a feature pack? as I don't seem to have it and I think I've updated all components to latest.
Regards
Is it part of a feature pack? as I don't seem to have it and I think I've updated all components to latest.
Regards
-
- Valued Contributor
- Posts: 784
- Joined: Fri Jun 06, 2014 3:53 pm
- Has thanked: 186 times
- Been thanked: 205 times
Re: Pic12f683 - rs232 FL8 in target do not work
Hi
I have it in FC8 but not FC7.
I'm running FC 7.3.0.7 and I've downloaded latest components from here
https://www.matrixtsl.com/resources/fil ... -11-19.zip
Maybe it does need a feature pack I don't have on FC7
Regards
I have it in FC8 but not FC7.
I'm running FC 7.3.0.7 and I've downloaded latest components from here
https://www.matrixtsl.com/resources/fil ... -11-19.zip
Maybe it does need a feature pack I don't have on FC7
Regards
-
- Matrix Staff
- Posts: 9521
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
Re: Pic12f683 - rs232 FL8 in target do not work
No, does not need a feature pack.
I was solely created for V8.
However you can get it to work in V7.
Go to this post
Download
Open in V7.
Add your own image for the component
Use the component export option within File menu.
You can then use it in V7
I was solely created for V8.
However you can get it to work in V7.
Go to this post
Download
Code: Select all
IsSim.fcfx
Add your own image for the component
Use the component export option within File menu.
You can then use it in V7
Martin
-
- Valued Contributor
- Posts: 784
- Joined: Fri Jun 06, 2014 3:53 pm
- Has thanked: 186 times
- Been thanked: 205 times
-
- Matrix Staff
- Posts: 9521
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
Re: Pic12f683 - rs232 FL8 in target do not work
You're welcome.
don't forget, after exporting you will need to reload Flowcode or flowchart for it to appear.
don't forget, after exporting you will need to reload Flowcode or flowchart for it to appear.
Martin