Hi again I'm very confused.
Why can't I send and receive?!?😫😫😫😫 I tested both codes,integer and ASCII code , but I read incorrect data. What is your suggestions ?! On Saturday, April 24, 2021 at 2:23:56 PM UTC+4:30 Kiste wrote: > It is important whether you use one or the other. If the sender speaks > tagalog, and the receiver expects to hear mandarin, they won't be able to > communicate. > > Greets, > Kiste > > > > > > > Am Samstag, 24. April 2021, 11:49:49 MESZ hat majid ebru < > [email protected]> Folgendes geschrieben: > > > > > > Hi > > It isn't important that I read ASCII or .... . > It is important that I read true. > > Thanks , I will test and I say result. > > On Saturday, April 24, 2021 at 11:59:22 AM UTC+4:30 [email protected] > wrote: > > > > > > Hi Majid, > > > > > > > > > > If you want to print it - as ASCII -on the receiving side, change > > > > > > > > > > temp[i] = char > > > > by > > > > temp[i] = char + "0" > > > > > > > > > > Then you can print it. > > > > > > > > > > Kind regards, > > > > > > > > > > Rob > > > > > > > > > > > > ________________________________ > > Van: 'Oliver Seitz' via jallib <[email protected]>Verzonden: > zaterdag 24 april 2021 09:07Aan: [email protected] < > [email protected]> > > Onderwerp: Re: NT: [jallib] How to send & receive data over medium > distance > > You're sending binary and trying to receive ad ASCII > > > > > > > > > > > > > > Am Samstag, 24. April 2021, 09:00:37 MESZ hat majid ebru < > [email protected]> Folgendes geschrieben: > > > > > > > > > > > > For example,I want to send 642 .... > > > > I use this code in sender > > ... > > Serial_sw_data = 6 > > Delay_1ms(2) > > Serial_sw_data = 4 > > Delay_1ms(2) > > Serial_sw_data = 2 > > Delay_1ms(2) > > ... > > > > But in receiver , I can't read correctly. > > > > Var byte Temp[3] > > Var byte i = 0 > > For loop > > If serial_sw_read(char) then > > Temp[i] = char > > Print_string(lcd,Temp[i]) > > i = i + 1 > > If 2 < i then i = 0 end if > > End loop > > On Saturday, April 24, 2021 at 11:19:31 AM UTC+4:30 majid ebru wrote: > >> Thank all > >> > >> But I need sample code for read. > >> > >> Almost ,all documents use write code and I didn't saw read code. > >> > >> > >> On Saturday, April 24, 2021 at 10:58:36 AM UTC+4:30 vasile wrote: > >>> Majid, one good practice when you're testing communication between two > embedded systems (A and B) is to check each one with a terminal first. > >>> > >>> Assuming A is sending to B and B receives and does something on IO > port, test first the TX of A to the computer terminal, then RX of B from > the computer terminal. After that, only if each one works ok, connect TX/RX > of A with B. Some good free terminals for this job (search for:) Realterm, > Teraterm, Termite. You may also need a hardware converter which depends on > your computer (if you have a real COM port with RS232 levels or just an > USB/RS232 with 3.3V or 5V levels). > >>> > >>> This approach will protect you from a lot of trouble and make you > understand if a byte, a word, an ASCII or something else is truly > sent/received and was sent/received in the right order. > >>> > >>> Simplify your work by sending and receiving ASCII symbols first and > then understand all the used procedures from the libraries (this is > mandatory to understand which is your fault/misunderstanding or which is > the software bug... there are bugs in any software...:) ). > >>> > >>> > >>> > >>> On Sat, Apr 24, 2021 at 8:36 AM Rob CJ <[email protected]> wrote: > >>>> > >>>> > >>>> Hi Majid, > >>>> > >>>> > >>>> > >>>> > >>>> If you want to send an integer value you indeed have to send it in > bytes. But that thouls be faily easy with JAL. > >>>> > >>>> > >>>> > >>>> > >>>> If have for example a variable of type word you can do the following > >>>> > >>>> > >>>> > >>>> > >>>> var word my_word_variable > >>>> > >>>> var byte my_byte_variable_low at my_word_variable > >>>> > >>>> var byte my_byte_high at my_word_variable + 1 > >>>> > >>>> > >>>> > >>>> You can then send both 'my_byte' variables separately and in the > other PIC you do the same, read the two bytes which are mapped to a word. > >>>> > >>>> > >>>> > >>>> > >>>> Als see the documentation of the JAL compiler. > >>>> > >>>> > >>>> > >>>> > >>>> Kind regards, > >>>> > >>>> > >>>> > >>>> > >>>> Rob > >>>> > >>>> > >>>> > >>>> > >>>> > >>>> ________________________________ > >>>> Van: [email protected] <[email protected]> namens majid > ebru <[email protected]> > >>>> Verzonden: vrijdag 23 april 2021 19:47 > >>>> Aan: jallib <[email protected]> > >>>> Onderwerp: Re: NT: [jallib] How to send & receive data over medium > distance > >>>> > >>>> > >>>> > >>>> > >>>> Please help me > >>>> > >>>> > >>>> > >>>> I almost work with micro ,12 years ago . > >>>> > >>>> > >>>> > >>>> > >>>> Now I can't send / receive data?! > >>>> > >>>> > >>>> > >>>> > >>>> I should send and receive an integer(like adv value and ....) , but > in serial_sw_data I just can send a byte ?!?!!! > >>>> > >>>> And just read a byte with serial_sw_read(char)?! > >>>> > >>>> > >>>> > >>>> > >>>> I know that my kowlage about electronic is wake , but now I should do > read&write data?! > >>>> > >>>> > >>>> > >>>> > >>>> Please guide me,🙏🙏🙏🙏🙏🙏🙏🙏 > >>>> > >>>> > >>>> > >>>> > >>>> > >>>> On Thursday, April 22, 2021 at 11:23:23 PM UTC+4:30 > [email protected] wrote: > >>>> > >>>> > >>>>> > >>>>> > >>>>> Hi Majid, > >>>>> > >>>>> > >>>>> > >>>>> > >>>>> You have to provide more information. How do you know that they > stopped? Did you narrow down the code down to the minimal size to show that > it fails? If so you can share that code. > >>>>> > >>>>> > >>>>> > >>>>> > >>>>> And to answer your other - not posted - comment. Due to the fact > that you use this group to answer trivial questions that you can find on > the Internet (which you should not do) and which are specific JAL or PIC > related, your posts are now moderated. Only posts which are relevant to > this group are passed on to the other group members. > >>>>> > >>>>> > >>>>> > >>>>> > >>>>> Kind regards, > >>>>> > >>>>> > >>>>> Rob > >>>>> > >>>>> > >>>>> > >>>>> > >>>>> > >>>>> ________________________________ > >>>>> > >>>>> > >>>>> > >>>>> > >>>>> Van: [email protected] <[email protected]> namens majid > ebru <[email protected]> > >>>>> > >>>>> > >>>>> > >>>>> Verzonden: donderdag 22 april 2021 20:19 > >>>>> > >>>>> > >>>>> > >>>>> Aan: jallib <[email protected]>Onderwerp: Re: NT: [jallib] > How to send & receive data over medium distance > >>>>> > >>>>> > >>>>> > >>>>> Hi > >>>>> > >>>>> > >>>>> > >>>>> Please help me again😢😢😫😫🥺🥺🤔🤔 > >>>>> > >>>>> > >>>>> > >>>>> > >>>>> When I connected two PICs together , everything is ok. > >>>>> > >>>>> > >>>>> > >>>>> > >>>>> But when disconnect port serial , both PICs hanged ?!?! > >>>>> > >>>>> > >>>>> > >>>>> > >>>>> Both micro stoped , and when connected again ,both micro work > correctly?! > >>>>> > >>>>> > >>>>> > >>>>> > >>>>> In fact both micro stopped in line : if serial_sw_read(char)) then > block .... > >>>>> > >>>>> > >>>>> > >>>>> > >>>>> And doesn't run other codes🤔🥺😫😢 > >>>>> > >>>>> > >>>>> > >>>>> > >>>>> Why?! > >>>>> > >>>>> > >>>>> > >>>>> > >>>>> How should I do ?! > >>>>> > >>>>> > >>>>> On Wednesday, April 21, 2021 at 10:12:03 PM UTC+4:30 funlw65(Vasi) > wrote: > >>>>> > >>>>> > >>>>>> > >>>>>> The microcontroller boards that are used in Polish Universities are > all equipped with (external - note for Majid) RS485 chips. > >>>>>> > >>>>>> > >>>>>> > >>>>>> > >>>>>> > >>>>>> > >>>>>> On Wed, Apr 21, 2021 at 4:54 PM Rob CJ <[email protected]> wrote: > >>>>>> > >>>>>> > >>>>>> > >>>>>> > >>>>>>> > >>>>>>> > >>>>>>> Hi Majid, > >>>>>>> > >>>>>>> > >>>>>>> > >>>>>>> > >>>>>>> Please use Google to find out what RS485 and IIC is. Use the > Jallib group for issues with libraries and the compiler not for general > questions that you can easily find on the internet. > >>>>>>> > >>>>>>> > >>>>>>> > >>>>>>> > >>>>>>> Thanks. > >>>>>>> > >>>>>>> > >>>>>>> > >>>>>>> > >>>>>>> Kind regards, > >>>>>>> > >>>>>>> > >>>>>>> Rob > >>>>>>> > >>>>>>> > >>>>>>> > >>>>>>> > >>>>>>> > >>>>>>> ________________________________ > >>>>>>> Van: [email protected] <[email protected]> namens > majid ebru <[email protected]> > >>>>>>> Verzonden: woensdag 21 april 2021 15:47 > >>>>>>> Aan: jallib <[email protected]> > >>>>>>> Onderwerp: Re: NT: [jallib] How to send & receive data over medium > distance > >>>>>>> > >>>>>>> > >>>>>>> > >>>>>>> RS485 is very powerful. > >>>>>>> > >>>>>>> > >>>>>>> > >>>>>>> But I don't how to implement in PIC?!? > >>>>>>> > >>>>>>> > >>>>>>> > >>>>>>> > >>>>>>> Is i2c the same rs485?! > >>>>>>> > >>>>>>> > >>>>>>> > >>>>>>> > >>>>>>> On Wednesday, April 21, 2021 at 4:41:19 PM UTC+4:30 vasile wrote: > >>>>>>> > >>>>>>> > >>>>>>>> > >>>>>>>> > >>>>>>>> > >>>>>>>> At 15m and 5V there is no problem with data sent in current. > Using twisted wire cable is a good habit. > >>>>>>>> > >>>>>>>> From the EMI perspective twisted cable it is about half as good > as a shielded cable and has the parasitic capacity quite low compared with > the shielded cable. > >>>>>>>> > >>>>>>>> RS485 (standard 32 loads) is feasible at 1Km and quite high > speed. Still there is an issue with the ground line and requires good > terminators. > >>>>>>>> > >>>>>>>> Data goes either on A&B plus ground cable (three wires between Tx > and RX) or just A&B (two wire cable) and ground connected to earth on the > transmitter and receiver end. > >>>>>>>> > >>>>>>>> In the last configuration an issue is quite frequent caused by an > offset (variable ground potential between TX and RX). > >>>>>>>> > >>>>>>>> Also lightning is a problem for outdoor cables...and nothing > help... :)... no matter how others will convince you to put three tranzorbs > on each TX and RX end. > >>>>>>>> > >>>>>>>> happy communications! > >>>>>>>> > >>>>>>>> > >>>>>>>> > >>>>>>>> > >>>>>>>> > >>>>>>>> > >>>>>>>> > >>>>>>>> > >>>>>>>> > >>>>>>>> > >>>>>>>> > >>>>>>>> On Wed, Apr 21, 2021 at 8:32 AM 'Oliver Seitz' via jallib < > [email protected]> wrote: > >>>>>>>> > >>>>>>>> > >>>>>>>> > >>>>>>>> > >>>>>>>> > >>>>>>>> > >>>>>>>>> Thanks for the additional information, 800m is something very > different from 20m ;-) > >>>>>>>>> > >>>>>>>>> I can imagine that 20m at 5V ground-referenced is doable, but > when you're starting, better stick to the specifications and try your luck > when you have a bit of experience. > >>>>>>>>> > >>>>>>>>> I myself am at a similar project, like 15 meter, and I want to > use as little standby current as possible, and no twisted pairs. It's > uni-directional, with constant-current pullup at the receiver and optically > isolated pulldown at the sender with 1200 baud... First test of the concept > in a few days ;-) > >>>>>>>>> > >>>>>>>>> If standby current was of no concern, I'd use RS422 or RS485 > drivers/receivers, true RS232 is old-fashioned and needs to many components. > >>>>>>>>> > >>>>>>>>> > >>>>>>>>> Greets, > >>>>>>>>> Kiste > >>>>>>>>> > >>>>>>>>> Am Mittwoch, 21. April 2021, 07:02:46 MESZ hat vsurducan < > [email protected]> Folgendes geschrieben: > >>>>>>>>> > >>>>>>>>> > >>>>>>>>> > >>>>>>>>> > >>>>>>>>> > >>>>>>>>> Oliver, I remember the problems I had with an EIA232 with +/-8V > output running at 800m at 9600bps. Everything works until due the > transceiver heating the voltage dropped at +/-7.6V...:) > >>>>>>>>> The length is given by the voltage at the level converter of the > transmitter output. All level converters with charge pumps are not able to > give more than +/-8V...+/-10V in the happiest circumstances. > >>>>>>>>> Oldest/goldest EIA232 worked at +/-25V up to 2km. > >>>>>>>>> For 20m you do noy need any level converter at the output of > your PIC, just a twisted pair RX-GND TX-GND (CAT5 ethernet cable is > perfect) and an open collector transmitter ( a gate) with pull-up resistor > in the receiver end (at 20m distance from the transmitter). > >>>>>>>>> However Majid, I think you need first to learn jal and for that > there is a learning curve which has to be passed.... > >>>>>>>>> Please start with the examples, compile them, make them run, > modify them as you wish and post only when nothing works for you after > three days of trying...this will help you more than you may believe right > now... > >>>>>>>>> best wishes > >>>>>>>>> > >>>>>>>>> On Wed, Apr 21, 2021 at 7:28 AM 'Oliver Seitz' via jallib < > [email protected]> wrote: > >>>>>>>>>> Hi Majid, > >>>>>>>>>> > >>>>>>>>>> SPI is designed for centimeters, I don't think it can work > reliably over 20 meters. > >>>>>>>>>> > >>>>>>>>>> RS232 at 9600 baud is ok for 150 meters, if you're using real > RS232 drivers and receivers like from the MAX232 series. The PIC controller > does not have RS232, it has a usart which handles the NRZ protocol. This > protocol is best known as being used by the RS232 interface. Therefore the > protocol itself is commonly (but wrongly) referred to as "RS232" > >>>>>>>>>> > >>>>>>>>>> RS232 uses negative voltages as a symbolic "1" and positive > voltages for "0". At the receiving side, the voltage must at least go > higher than +3V for "0" and lower than -3V for "1". At the sending side, > voltages from up to +15V and down to -15V are used. > >>>>>>>>>> > >>>>>>>>>> So, to answer your question in two simple sentences: RS232 is > ok for the job. But RS232 is not what comes out of the controller. > >>>>>>>>>> > >>>>>>>>>> Greets, > >>>>>>>>>> Kiste > >>>>>>>>>> > >>>>>>>>>> > >>>>>>>>>> > >>>>>>>>>> > >>>>>>>>>> Am Dienstag, 20. April 2021, 21:56:34 MESZ hat majid ebru < > [email protected]> Folgendes geschrieben: > >>>>>>>>>> > >>>>>>>>>> > >>>>>>>>>> > >>>>>>>>>> > >>>>>>>>>> > >>>>>>>>>> can i ask another question?? > >>>>>>>>>> > >>>>>>>>>> if it is 20 meter distance between PICs , i should use RS232 or > SPI? > >>>>>>>>>> > >>>>>>>>>> so sorry and thanks a lot > >>>>>>>>>> > >>>>>>>>>> majid ebru در تاریخ سهشنبه ۲۰ آوریل ۲۰۲۱ ساعت > >>>>>>>>>> > >>>>>>>>>> -- > >>>>>>>>>> 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/1697687282.4677348.1618979276333%40mail.yahoo.com > . > >>>>>>>>>> > >>>>>>>>> > >>>>>>>>> > >>>>>>>>> -- > >>>>>>>>> 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/CAM%2Bj4qtaBjojssk_HHFK1M2dhhL9CNNf3mygd1F3nH0B5bck9A%40mail.gmail.com > . > >>>>>>>>> > >>>>>>>>> -- > >>>>>>>>> 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/1020737915.4719521.1618983169979%40mail.yahoo.com > . > >>>>>>>>> > >>>>>>>> > >>>>>>>> > >>>>>>>> > >>>>>>> > >>>>>>> > >>>>>>> > >>>>>>> -- > >>>>>>> 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/22c899b2-b475-404d-9982-fb4e9ffe3169n%40googlegroups.com > . > >>>>>>> > >>>>>>> > >>>>>>> > >>>>>>> > >>>>>>> -- > >>>>>>> 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/AM0PR07MB624188EEE1255C4E45C31F80E6479%40AM0PR07MB6241.eurprd07.prod.outlook.com > . > >>>>>>> > >>>>>> > >>>>>> > >>>>>> > >>>>>> -- > >>>>>> > >>>>>> Vasi > >>>>>> > >>>>> > >>>>> > >>>>> > >>>>> -- > >>>>> 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/ad446bf9-5eab-4168-8326-b33f2a02c0f5n%40googlegroups.com > . > >>>>> > >>>>> > >>>>> > >>>> > >>>> > >>>> > >>>> -- > >>>> 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/187dbbf2-8c1b-43c2-ac9b-ce320495f60fn%40googlegroups.com > . > >>>> > >>>> > >>>> > >>>> > >>>> -- > >>>> 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/AM0PR07MB6241CB67E4CBAE8CFD01D0D0E6449%40AM0PR07MB6241.eurprd07.prod.outlook.com > . > >>>> > >>> > > > > > > -- > > 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/2ac2d829-8399-4e1f-b7e2-1dfb83be12een%40googlegroups.com > > . > > > > -- > > 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/461455972.623361.1619248055142%40mail.yahoo.com > . > > > > > > > > > > > -- > 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/21329211-66fc-4dda-a32d-da472e0be127n%40googlegroups.com > . > > -- 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/6cc6adff-f8dc-4e70-999b-f72c53a0cdbbn%40googlegroups.com.
