PSPMODE 18F46K20

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 5.
To post in this forum you must have a registered copy of Flowcode 5 or higher.

Moderator: Benj

Post Reply
Ferla
Flowcode v5 User
Posts: 126
Joined: Sun Jan 06, 2013 8:58 pm
Location: Italy
Been thanked: 19 times
Contact:

PSPMODE 18F46K20

Post by Ferla »

Greetings to You all, and thanks for all the tips included in the forum. I wanted to ask your advice because it is from 2 weeks that I can not get out of this situation :? . I need to send and receive mode using RS232 outputs psp pic, can you help me? Should I use PSPMODE pic 18F46K20 using that Fuses found in the file attached. Basically I have to translate to these commands Picbasic language to Flowcode. The fuses should be corrected because read from the original project.

******************************* TEST I/O ******************************
******PIC_TX = PortC4
******PIC_RX = PortD6

for i=1 to TEST
serOUT PIC_TX,T9600,["PROVA",13,10]
SERIN PIC_RX,N9600,400,SALTA,[">OK<"]
lcdout $FE, $C0, "PIC I/O...OK"
I=TENTATIVI+2
SALTA:
next i
IF I=TEST+1 THEN
lcdout $FE, $C0, "PIC I/O...PROBLEM"
ENDIF

'******************************* TEST RTC *****************************
******RTC_TX = PortD2
******RTC_RX = PortD3

for i=1 to TEST
SEROUT2 RTC_TX,84,["INTERROGAZIONE",13,10]
serIN RTC_RX,T9600,400,TESTAVVENUTO,["T"]
lcdout $FE, $94, "RTC...FUNZIONANTE"
I=TENTATIVI+2
TESTAVVENUTO:
next i
IF I=TEST+1 THEN
lcdout $FE, $94, "RTC...PROBLEM"
ENDIF
*********************************************************************************


You can kindly help me.I use FC 5.5 Pro
I thank everyone.
Greetings
Ferla
Attachments
Test RS232 pic18f46K20.fcf
(14.71 KiB) Downloaded 730 times

kersing
Valued Contributor
Valued Contributor
Posts: 2045
Joined: Wed Aug 27, 2008 10:31 pm
Location: Netherlands
Has thanked: 553 times
Been thanked: 1081 times
Contact:

Re: PSPMODE 18F46K20

Post by kersing »

Ferla,

According to the data sheet PSPMODE is used for parallel port, you are referring to RS232 which is totally different. If you are trying to use serial communications the RS232 component should provide what you need. You will have to use software serial as the pins listed in the picbasic code are not the hardware serial pins for this device.

Best regards,

Jac
“Integrity is doing the right thing, even when no one is watching.”

― C.S. Lewis

Ferla
Flowcode v5 User
Posts: 126
Joined: Sun Jan 06, 2013 8:58 pm
Location: Italy
Been thanked: 19 times
Contact:

Re: PSPMODE 18F46K20

Post by Ferla »

Hi Jac
Thank you for your response. I'll explain the request. The serial ports of the Pic (RC6-RC7) are occupied by a GSM module, while the other port RD3 RD2 compliance should communicate rs232 to an RTC link> http://www.futuraelettronica.net/pdf_it ... FT674M.pdf , while the port RD6-RC4 must always communicate serially to a pic 16F88 (RA3-RA4).
I think if I could have some examples would help not only me but also other members of the forum. I do not find many examples on how to use the PSPMode.

Best regards
Ferla

kersing
Valued Contributor
Valued Contributor
Posts: 2045
Joined: Wed Aug 27, 2008 10:31 pm
Location: Netherlands
Has thanked: 553 times
Been thanked: 1081 times
Contact:

Re: PSPMODE 18F46K20

Post by kersing »

Hi Feria,

Could you quote (from data sheets or manual or something like it) what PSPMode is and explain why you want to use it? For three serial ports you can use three RS232 components.

Best regards,

Jac
“Integrity is doing the right thing, even when no one is watching.”

― C.S. Lewis

Ferla
Flowcode v5 User
Posts: 126
Joined: Sun Jan 06, 2013 8:58 pm
Location: Italy
Been thanked: 19 times
Contact:

Re: PSPMODE 18F46K20

Post by Ferla »

When I saw that you could connect more serial interfaces to a pic with a single hardware interface I am intrigued, and I started to understand how it is possible .Today are many modules with serial interface that's why I want aprofondire this topic with the help of experts forum friends, I know there are many good people who know a lot about these topics and can help me like you doing.
It is perhaps correct to use three components serial, but trying to TX and RX. Suggestion of Medelec35 I may have problems with the timer1.
I tried to create a counter with visual display, I noticed that the display by seconds is very slow, and perhaps the reason why I can not send and receive RS232 to ports C4, D6, D2, D3.
What do you think you have an idea, you can not create an instance of transmission and reception in RS232 with these ports.
I would be really grateful. I have also seen this example of Kersing
viewtopic.php?f=26&t=12315&p=48200&hili ... ial#p48200
but I do not understand how to use macros.

Thanks,sorry for my english :oops:
Ferla

kersing
Valued Contributor
Valued Contributor
Posts: 2045
Joined: Wed Aug 27, 2008 10:31 pm
Location: Netherlands
Has thanked: 553 times
Been thanked: 1081 times
Contact:

Re: PSPMODE 18F46K20

Post by kersing »

If you want to connect multiple serial devices without running into tons of issues I would suggest not to try sharing the serial port. Sharing a serial port requires the devices to play along nicely, something over 99% of the devices do not do.

The Flowcode RS232 component allows setting the RX and TX pins if you use the software serial port.

I do not know what issues you had with timer1, looking at the history of your account I can not find any messages posted by you apart from those in this thread. Are you using multiple accounts???

The forum post you are referring to is useful for sending data only and is not required for users of Flowcode Professional as it has a software RS232 component.

I've imported you flowchart into FC6 (as I do not have FC5 installed on this computer) and it looks like the oscillator setting might be invalid. Have you tried the basic code of trying to flash a led with a 1 second delay to check the controller configuration is correct and the clock is set up correctly? If one of these is not correct RS232 communication will never work.

(Your English is way better than my Italian)
“Integrity is doing the right thing, even when no one is watching.”

― C.S. Lewis

Ferla
Flowcode v5 User
Posts: 126
Joined: Sun Jan 06, 2013 8:58 pm
Location: Italy
Been thanked: 19 times
Contact:

Re: PSPMODE 18F46K20

Post by Ferla »

Hi all
Sorry, I spoke to wanted to say Timer1 instead Timer0.
We start from the beginning.
I realized that the PSPMode is not what I need, but just use the RS232 components setting to software.
A test with display count seconds that the slow, same thing with the test led. Perhaps this is the cause of the problem I have with RS232
Why is so slow, the fuses I have extrapolated from the original project that works fine?

Assure no multiple accounts..
Best regards,
Ferla
Attachments
Test LCD Seconds count.fcf
(13.56 KiB) Downloaded 740 times

kersing
Valued Contributor
Valued Contributor
Posts: 2045
Joined: Wed Aug 27, 2008 10:31 pm
Location: Netherlands
Has thanked: 553 times
Been thanked: 1081 times
Contact:

Re: PSPMODE 18F46K20

Post by kersing »

Does your hardware have an external oscillator? If so witch frequency? RS232 will not work if the clock is not set correctly, so if the one second blinker is not one second there is little chance serial communications will work.

Does the original software set osccon?
“Integrity is doing the right thing, even when no one is watching.”

― C.S. Lewis

Ferla
Flowcode v5 User
Posts: 126
Joined: Sun Jan 06, 2013 8:58 pm
Location: Italy
Been thanked: 19 times
Contact:

Re: PSPMODE 18F46K20

Post by Ferla »

The Micros has not external oscillator, in attegato find the original configuration. As I mentioned with the programmer I read a Pic fully functional and used the same fuses that have attached files (* fcf) posted in the emails past, but there are with timing. You can find some ruse ?
I really appreciate your concern for my problem :P
thank you
Ferla
Attachments
Micro Original Configure.txt
(1.46 KiB) Downloaded 551 times

kersing
Valued Contributor
Valued Contributor
Posts: 2045
Joined: Wed Aug 27, 2008 10:31 pm
Location: Netherlands
Has thanked: 553 times
Been thanked: 1081 times
Contact:

Re: PSPMODE 18F46K20

Post by kersing »

As asked in the previous message, please check if the original program sets the OSCCON register. The internal oscillator runs at 1MHz by default, however in your settings you are using 16MHz. For the oscillator to run at 16MHz you need to add a C code block to your flowchart as the clock frequency is not set using the configuration registers.

Code: Select all

osccon=0b0111000;
“Integrity is doing the right thing, even when no one is watching.”

― C.S. Lewis

Ferla
Flowcode v5 User
Posts: 126
Joined: Sun Jan 06, 2013 8:58 pm
Location: Italy
Been thanked: 19 times
Contact:

Re: PSPMODE 18F46K20

Post by Ferla »

Hello Kersing
You must excuse me if I did not answer but I was away on business and now that I'm back I will continue my project.
You're right, I covered the data sheet Pic and in default he is 1Mhz. Tonight I try to create a macro using the TMR0, hope will be able to find the correct timing.
A question now that I insert the C code I have set equally 16Mhz in Flowcode or I can leave 19.660800MHz for transmission times RS232?
Thank you
Ferla

kersing
Valued Contributor
Valued Contributor
Posts: 2045
Joined: Wed Aug 27, 2008 10:31 pm
Location: Netherlands
Has thanked: 553 times
Been thanked: 1081 times
Contact:

Re: PSPMODE 18F46K20

Post by kersing »

If you include the listed code in a C code icon you need to set the clock speed in properties to 16MHz. If you do not include it set the clock speed to 1MHz. If you leave the clock speed at 19.6608MHz RS232 timing will not be correct and as a result RS232 will not work.
“Integrity is doing the right thing, even when no one is watching.”

― C.S. Lewis

Ferla
Flowcode v5 User
Posts: 126
Joined: Sun Jan 06, 2013 8:58 pm
Location: Italy
Been thanked: 19 times
Contact:

Re: PSPMODE 18F46K20

Post by Ferla »

Thanks Jac
with your help I was able to set the right frequency oscillator see post http://www.matrixtsl.com/mmforums/viewt ... 46&t=16986
even if it lacked a "0" osccon=0b01110000; . Now he's fighting with the proper time to send the string in RS232
Thanks
Ferla

Post Reply