Hi Rob, Vasile,

@Vasile
No complicated at all to invert signals using FT_prog;
https://ftdichip.com/wp-content/uploads/2022/05/FT_Prog_v3.12.29.638-Installer.zip
Very easy. Two clicks after installed and there you go.
You can invert any of RS232 signals, but only TX neeeded to be inverted.

@Rob
Yes. Vasile had already noticed that mistake.
It was already corrected and solved that baudrate divergence.
All fine now. Including Serial_Hardware lib is working like a charm.

Never enough to thank you all !!!
You guys rock.

Best regards,
Filipe Santos.


On Wednesday, May 18, 2022 at 5:42:04 PM UTC+1 vasile wrote:

> Hi, one possibility  is to use one single inverter gate like SN74LVC1G04, 
> one digital transistor ( base resistor connected internally) and one 
> resistor in collector or any other already explained. 
> The FT232RL can invert the TX, however it seems so complicated ( it needs 
> to program the internal eeprom, see AN121 FTDI accessing the eeprom user 
> area) that it is much simpler to correct it in external hardware.
> http://www.ftdichip.com/Support/Documents/DataSheets/ICs/DS_FT232R.pdf
>
>
> On Wed, May 18, 2022 at 8:45 AM 'Oliver Seitz' via jallib <
> [email protected]> wrote:
>
>> Great, that error is fixed :-)
>>
>> Now here's what the PIC sends, and what I presume the PC receives:
>>
>> Seq. Lvl   Pic sends   PC receives (inverted)
>>
>> -3    1    idle        framing error   
>> -2    1    idle        framing error
>> -1    1    idle        framing error
>>  0    0    startbit    idle
>>  1    0    0*1+        idle
>>  2    1    1*2+        startbit
>>  3    0    0*4+        1*1+
>>  4    0    0*8=2       1*2+
>>  5    0    0*1+        1*4+
>>  6    1    1*2+        0*8=7
>>  7    0    0*4+        1*1+
>>  8    0    0*8=2       2*2+
>>  9    1    Stopbit     0*4+
>> 10    0    startbit    1*8=b
>> 11    0    0*1+        stopbit
>> 12    1    1*2+        startbit
>> 13    0    0*4+        1*1+
>> 14    0    0*8=2       1*2+
>> 15    0    0*1+        1*4+
>> 16    1    1*2+        0*8=7
>> 17    0    0*4+        1*1+
>> 18    0    0*8=2       1*2+
>> 19    1    Stopbit     0*4+
>> 20    1    idle        0*8=3
>> 21    1    idle        framing error
>> 22    1    idle        framing error
>> 23    1    idle        framing error
>> 24    1    idle        framing error
>>
>> You see, "b7 37" is exactly what to expect when the baudrate is correct, 
>> and the polarity is not. You just need to fix the polarity. For the 
>> transmission from the PIC to the PC you can either switch RX on the PC to 
>> non-inverted mode, or invert TX on the PIC like
>>
>> BAUDCON1_SCKP=1
>>
>> However, this PIC does not allow inverting its RX easily, so you need to 
>> switch the PCs TX to non-inverted mode or invert the signal by other means. 
>> That other means can be a transistor and two resistors, or a dedicated IC, 
>> even a NE555 can do it. Or, as mentioned before, if you've got an unused 
>> pin on the PIC, you can use an unused peripheral of your PIC to invert the 
>> signal.
>>
>> Greets,
>> Kiste
>>     
>>
>>
>>
>> Am Dienstag, 17. Mai 2022, 23:16:31 MESZ hat flyway38 <[email protected]> 
>> Folgendes geschrieben: 
>>
>>
>> Hi Kiste,
>>
>> Thank you very much.
>> That solved the baudrate issue.
>>
>> But serial_hardware still don't work as it should.
>> Still have Frame and Break error on PC side.
>>
>> Now, your code;
>> forever loop
>>    serial_hw_data=0x22
>>    serial_hw_data=0x22
>>    delay_1s(1)
>> end loop
>>
>> Results;
>> b7 37 00                                         ·7.             
>> b7 37 00                                         ·7.             
>> b7 37 00                                         ·7.             
>> b7 37 00                                         ·7.             
>> b7 37 00                                         ·7.             
>> b7 37 00                                         ·7.             
>> b7 37 00                                         ·7.             
>> b7 37 00                                         ·7.             
>> b7 37 00                                         ·7.             
>> b7 37 00                                         ·7.             
>> b7 37 00                                         ·7.             
>> b7 37 00                                         ·7.             
>> b7 37 00                                         ·7.             
>> b7 37 00                                         ·7.             
>> b7 37 00                                         ·7.             
>> b7 37 00                                         ·7.             
>> b7 37 00                                         ·7.             
>> b7 37 00                                         ·7.             
>> b7 37 00                                         ·7.             
>> b7 37 00                                         ·7.             
>> b7 37 00                                         ·7.             
>> b7 37 00                                         ·7.             
>> b7 37 00                                         ·7.             
>> b7 37 00                                         ·7.             
>> b7 37 00                                         ·7.             
>> b7 37 00                                         ·7.             
>>
>> Cannot understand what's going on.
>> Anymore ideas?
>>
>> Cheers,
>> Filipe Santos.
>> On Tuesday, May 17, 2022 at 8:34:17 PM UTC+1 Kiste wrote:
>>
>> So, here it is:
>>
>> pragma target clock 20_000_000                   -- oscillator frequency
>> pragma target RSTOSC   HFINT32                   -- power-up clock 
>> select: OSC
>>
>> You're telling the compiler, the PIC would run at 20MHz, and you're 
>> setting the PIC to 32MHz. 
>>
>> Make it
>>
>> pragma target clock 32_000_000                   -- oscillator frequency
>>
>> and your baudrate will be as specified.
>>
>> Greets,
>> Kiste 
>>
>> Am Dienstag, 17. Mai 2022, 21:12:10 MESZ hat flyway38 <[email protected]> 
>> Folgendes geschrieben: 
>>
>>
>> Hi again Kiste,
>>
>> Here my code pragmas;
>>
>> -- Pragmas/ configuration memory settings (fuses)
>> pragma target clock 20_000_000                   -- oscillator frequency
>> pragma target OSC      OFF                       -- HS crystal or 
>> resonator
>> pragma target RSTOSC   HFINT32                   -- power-up clock 
>> select: OSC
>> pragma target CLKOUTEN DISABLED                  -- no clock output
>> pragma target WDT      DISABLED                  -- watchdog
>> pragma target DEBUG    DISABLED                  -- no debugging
>> pragma target BROWNOUT DISABLED                  -- no brownout reset
>> pragma target FCMEN    DISABLED                  -- no clock monitoring
>> pragma target CSWEN    ENABLED                   -- allow writing OSCCON1 
>> NOSC and NDIV
>> pragma target LVP      DISABLED                  -- no low voltage 
>> programming
>> pragma target MCLR     EXTERNAL                  -- external reset
>> -- The configuration bit settings above are only a selection, sufficient
>> -- for this program. Other programs may need more or different settings.
>> --
>> WDTCON_SWDTEN = OFF                              -- disable watchdog
>> --
>> _usec_delay (100_000)                            -- wait for power to 
>> stablilize
>> --
>> enable_digital_io()                              -- make all pins digital 
>> I/O
>>
>> Cheers
>> Filipe Santos.
>> On Tuesday, May 17, 2022 at 7:05:54 PM UTC+1 Kiste wrote:
>>
>> Hi Filipe,
>>
>>
>> I suspect the baudrate problem in settings like
>>
>> pragma target clock  ?
>> pragma target OSC ?
>> pragma target RSTOSC ?
>>
>> OSCCON* = ?
>>
>> What are these settings?
>>
>> Greets,
>> Kiste
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "jallib" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected].
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/jallib/6e0906ee-c9ec-4f45-94fb-3f99356d83aen%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/jallib/6e0906ee-c9ec-4f45-94fb-3f99356d83aen%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "jallib" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected].
>> To view this discussion on the web visit 
>>
>> https://groups.google.com/d/msgid/jallib/2a51961c-ca87-4ba0-b033-c7898ef83840n%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/jallib/2a51961c-ca87-4ba0-b033-c7898ef83840n%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "jallib" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected].
>>
> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/jallib/401018371.2597514.1652852628853%40mail.yahoo.com
>>  
>> <https://groups.google.com/d/msgid/jallib/401018371.2597514.1652852628853%40mail.yahoo.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"jallib" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jallib/83cc26c7-ff88-4645-86b9-4b480a1752den%40googlegroups.com.

Reply via email to