Injector and RS232 simulation

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

Moderator: Benj

crispin12
Posts: 51
Joined: Fri Apr 07, 2017 5:51 pm
Has thanked: 6 times
Been thanked: 11 times
Contact:

Injector and RS232 simulation

Postby crispin12 » Mon Jul 30, 2018 9:50 am

Playing with the downloaded file "RS232_Example2.fcfx (6470 bytes)" example from Matrix that illustrates character Rx and use of an Injector.
It works fine but I can't get it to do what I want. Every time I hit a key on the PC keyboard the simulation transmits the character immediately and I see the char on the terminal window. What I want is to type 4 chars on the keyboard as a string then hit the RETURN key to send all 4 chars as a string instead of each char being sent singly.

I've tried substituting the Injector with the AT Injector but can't get that to work at all inside the "RS232_Example2". It doesn't matter what I press on the keyboard the sim is dormant. I suspect this injector only works with the GPS component as per the help file but I want to use it with the RS232

Has anyone got an edited version of the RS232_Example2 OR ANY RS232 flowcode Injector that works as a character string transmission as described above?
Thanks in advance.

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8812
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2558 times
Been thanked: 3712 times
Contact:

Re: Injector and RS232 simulation

Postby medelec35 » Mon Jul 30, 2018 1:05 pm

Is this What you're after?
Attachments
RS232_Example2 RX String.fcfx
(10.69 KiB) Downloaded 72 times
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

crispin12
Posts: 51
Joined: Fri Apr 07, 2017 5:51 pm
Has thanked: 6 times
Been thanked: 11 times
Contact:

Re: Injector and RS232 simulation

Postby crispin12 » Mon Jul 30, 2018 2:17 pm

Thanks for replying Martin but sadly no this isn't it. Your example is collecting single characters transmitted one at a time and assembling them into a string at the PIC to print on the LCD. What I want is to type on the pc keyboard a series of characters and ONLY transmit the series or group of chars in one go (as a string) AFTER hitting the ENTER key ... just like a normal terminal. So if I want to send "hello" I want to send it as the word after hitting ENTER or RETURN. Not transmitting h after typing h, e after typing e, l after typing l etc. I was hopping the Injector would store the typed commands and then send the whole string out to the PIC on command. Surely this must be possible?

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

Re: Injector and RS232 simulation

Postby Benj » Mon Jul 30, 2018 3:24 pm

Hello,

What about pasting text into the HI injector queue? Would this do what you require.

I can maybe add a new property to the HI injector component that would allow for a wait until CR is hit to return a line but it gets quite complicated to do correctly.

If my suggestion of pasting text is not ok then let me know and I will investigate further for you.

crispin12
Posts: 51
Joined: Fri Apr 07, 2017 5:51 pm
Has thanked: 6 times
Been thanked: 11 times
Contact:

Re: Injector and RS232 simulation

Postby crispin12 » Mon Jul 30, 2018 5:43 pm

Yes, that does work. Thanks Ben. Don't know why I didn't think of that.
Anyway in order to give back to the community I am enclosing here a new Flowcode example file which is a modified version of the earlier character transmission, edited, to show an example of a 9 character string sent by the injector to the PIC's RS232 UART. The string data is pasted into the injector queue as suggested by Ben. If the entire 9 character string is successfully received it is printed out to the LCD module as confirmation.
The data is held on the LCD for 5 seconds before clearing and looping round to await the next received 9 character string. The string length can be modified to suit by changing the variable properties and editing the macros.
Attachments
RS232_String_Injector_Example.fcfx
(9.4 KiB) Downloaded 64 times
These users thanked the author crispin12 for the post:
Benj (Tue Jul 31, 2018 10:59 am)
Rating: 5%
 

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8812
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2558 times
Been thanked: 3712 times
Contact:

Re: Injector and RS232 simulation

Postby medelec35 » Tue Jul 31, 2018 1:07 am

Hi,
Sorry I misread and I hopefully understand fully now.
The attached flowchart is designed to work in both hardware and simulation modes.
Using RX interrupt for hardware so no chars are missed!
The LCD will show what mode it's running in and will count accumulated chars.
You can enter 1 to 16 chars but you will need to terminate with a carriage return before all the chars are displayed.
You can use a text editor to do that.
Just type chars then return and just make you you copy the next line down.
If copied and paste correctly you should see:
Console1.png
Console1.png (4.19 KiB) Viewed 2606 times

Note:
Count2 is not required for correct functionality, its solely for test purposes only
Hope this is more like you're after?
Attachments
RS232_String_Injector_Example 2c 16f1937.fcfx
(19.59 KiB) Downloaded 79 times
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

crispin12
Posts: 51
Joined: Fri Apr 07, 2017 5:51 pm
Has thanked: 6 times
Been thanked: 11 times
Contact:

Re: Injector and RS232 simulation

Postby crispin12 » Tue Jul 31, 2018 6:48 pm

Holy cow Martin! That is some amazing work you've produced. You certainly don't do things by half do you :)

I have to confess to finding some of the code a bit beyond my skills ... I mean it looks like you've got some custom icons in there that I've never seen before so how you came up with that design is a mystery. However, it works brilliantly (even if I don't quite get how its done). Absolutely amazing. Shouldn't this go on to the Matrix Multimedia Wiki and basic help files? I don't know about anyone else but at some point in the future it would be great if there could be some extra documentation for this design for wimps like me that need a bit more hand holding :cry:
These users thanked the author crispin12 for the post:
medelec35 (Wed Aug 08, 2018 8:01 am)
Rating: 5%
 

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8812
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2558 times
Been thanked: 3712 times
Contact:

Re: Injector and RS232 simulation

Postby medelec35 » Tue Jul 31, 2018 7:16 pm

Thank you crispin12,
it's really appreciated.
I'm glad
crispin12 wrote: it works brilliantly

If you would like to learn about anything in particular then let me know and I can assist you further.
When you say custom, I assume you're referring to:
Sim Icon.png
Sim Icon.png (2.41 KiB) Viewed 2588 times
?
If so that's for simulation.
I got the idea from Benj's post with instructions.
These users thanked the author medelec35 for the post (total 2):
petesmart (Tue Jul 31, 2018 11:12 pm) • crispin12 (Wed Aug 01, 2018 5:00 pm)
Rating: 10%
 
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.