Rob and Kiste and Vasile 
Thank you very much to help me
🙏🙏🙏🙏🙏🙏🙏🙏🙏💯💯💯💯❤️❤️💐💐💐💐💐💐💐

I change program and I can send/receive with software serial

But I still can't correctly read data😢😥😫😢🤔🥺
‪majid ebru‬‏ در تاریخ سه‌شنبه ۲۰ آوریل ۲۰۲۱ ساعت ۲۲:۲۷:۵۴ (UTC+4:30) نوشت:

> 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‬‏ در تاریخ سه‌شنبه ۲۰ آوریل ۲۰۲۱ ساعت ۲۲:۲۳:۳۵ (UTC+4:30) نوشت:
>
>> no
>> out_3 just is sample for detective that i read data1
>>
>> when PIC1send '2',how can i read that in PIC2??
>>
>> ----------------     PIC 1  -------
>> serial_hw_data = "2"
>>
>> ----------------  PIC2  ------------------
>>
>>     if (serial_hw_read(char))    then block
>> --Out_3 = 1   --
>>        if char == 2 then
>>          Out_2 = 1
>>         end if
>>        if char == "2" then
>>          Out_2 = 1
>>         end if
>>      end block
>>     end if
>>
>> ------
>>
>> but in PIC2 i can't set "out_2"??
>>
>> how can i correctly  read data in PIC2?
>> [email protected] در تاریخ سه‌شنبه ۲۰ آوریل ۲۰۲۱ ساعت ۲۲:۱۱:۲۱ 
>> (UTC+4:30) نوشت:
>>
>>> Hi Majid,
>>>
>>> You have to give some more info on what you try to achieve.
>>>
>>> In your example you always make Out_3 equal to 1 and Out_2 only if char 
>>> equals 2. Is that what you want or did you mean something like this:
>>>
>>> forever loop
>>>     if (serial_hw_read(char))   then 
>>>         if char == 3 then
>>>          Out_3 = 1
>>>        elsif char == 2 then
>>>          Out_2 = 1
>>>        end if
>>>     end if
>>>
>>> Kind regards,
>>>
>>> Rob
>>>
>>> ------------------------------
>>> *Van:* [email protected] <[email protected]> namens majid 
>>> ebru <[email protected]>
>>> *Verzonden:* dinsdag 20 april 2021 19:33
>>>
>>> *Aan:* jallib <[email protected]>
>>> *Onderwerp:* Re: [jallib] How to send & receive data with interrupt in 
>>> RS232
>>> Hi everybody
>>>
>>> how can i rad data??
>>>
>>> i use this code :
>>>
>>> var byte char
>>> forever loop
>>>     if (serial_hw_read(char))    then block
>>>          Out_3 = 1
>>>        if char == 2 then
>>>          Out_2 = 1
>>>        end if
>>> --- or ----
>>>        if char == "2" then
>>>          Out_2 = 1
>>>         end if
>>>      end block
>>>     end if
>>>
>>> -------------------
>>> but when i send data ,  only "out_3" work and "out_2" don't work?!
>>>
>>> should i convert "char"?
>>>
>>> ‪majid ebru‬‏ در تاریخ سه‌شنبه ۲۰ آوریل ۲۰۲۱ ساعت ۲۱:۴۵:۴۳ (UTC+4:30) 
>>> نوشت:
>>>
>>>
>>> ‪ 
>>> Thanks from all that help me
>>>
>>> 👍👍👍👍👍👍💯💯💯💯💯
>>>
>>> I almost can send and receive
>>>
>>> Thank you very much
>>>
>>> I try more .....
>>> [email protected] در تاریخ سه‌شنبه ۲۰ آوریل ۲۰۲۱ ساعت ۲۱:۱۶:۵۹ 
>>> (UTC+4:30) نوشت:
>>>
>>> Hi Majid,
>>>
>>> Did your scross the wires? So TX of PIC1 is connected to the RX of PIC2 
>>> and the RX of PIC1 is connected to the TX of PIC2?
>>>
>>> Also. I you want to test if the data is transmitted between the PICs, 
>>> first minimize your program to see if that works before adding all other 
>>> code.
>>>
>>> I changed your code and simplified it to test the communication only
>>>
>>> if a button is pressed on PIC1 it sends "1"to PIC2 and the LED on PIC1 
>>> goes off. If PIC2 receives a "1" the LED on PIC2 goes on. If a button is 
>>> pressed on PIC2 it sends "2" to PIC1 and the LED on PIC2 goes off. If PIC1 
>>> receives a "2" the LED on PIC1 goes on.
>>>
>>> If this works then you know your communication is working. 
>>>
>>> See attached simplified programs. I did not test this since I do not 
>>> have the hardware but the program speaks for itself.
>>>
>>> Kind regards,
>>>
>>> Rob
>>>
>>>
>>>
>>> ------------------------------
>>> *Van:* [email protected] <[email protected]> namens majid 
>>> ebru <[email protected]>
>>> *Verzonden:* dinsdag 20 april 2021 18:23
>>>
>>> *Aan:* jallib <[email protected]>
>>> *Onderwerp:* Re: [jallib] How to send & receive data with interrupt in 
>>> RS232
>>> please help me
>>> this is important for me
>>>
>>>
>>> ‪majid ebru‬‏ در تاریخ سه‌شنبه ۲۰ آوریل ۲۰۲۱ ساعت ۲۰:۵۰:۴۸ (UTC+4:30) 
>>> نوشت:
>>>
>>> i downloaded last version JALlib
>>> Thanks
>>>
>>> but i yet can't send and receive data between two PICs
>>>
>>> i clear my program
>>> please see again my program 
>>>
>>> i send data from pic number 2 (B7.jal) to pic number 1(A7.jal)
>>>
>>> when i pressed button1 from pic1 ,  i  send data with use 
>>> "serial_hw_write(255)"  to pic2 .
>>>
>>>
>>>
>>> ‪majid ebru‬‏ در تاریخ سه‌شنبه ۲۰ آوریل ۲۰۲۱ ساعت ۱۹:۵۴:۴۵ (UTC+4:30) 
>>> نوشت:
>>>
>>> I download jallib from github 
>>> I download jallib   JALPack 2.4.o 0 0.9.0.9 from just another language 
>>> site
>>>
>>> Where should I download new jallib?!
>>>
>>>
>>> ‪majid ebru‬‏ در تاریخ سه‌شنبه ۲۰ آوریل ۲۰۲۱ ساعت ۱۹:۵۲:۱۰ (UTC+4:30) 
>>> نوشت:
>>>
>>> [image: 20210420_194852~01.jpg]
>>> sorry ,i can't edit my post so i should send new post. 
>>>
>>>
>>> i just want send and receive data between two PIC
>>> ‪majid ebru‬‏ در تاریخ سه‌شنبه ۲۰ آوریل ۲۰۲۱ ساعت ۱۹:۴۲:۵۶ (UTC+4:30) 
>>> نوشت:
>>>
>>> when i use your program , i have some Error
>>> -----------------------
>>> Compilation started at :4/20/2021 6:41:55 PM
>>>
>>> jal 2.4o (compiled May  8 2011)
>>> [Error] (lib/serial_hw_int_cts.jal) [Line 357]  
>>> "serial_overflow_discard" not defined
>>> [Error] (lib/serial_hw_int_cts.jal) [Line 357]  ')' expected (got 
>>> 'serial_overflow_discard')
>>> [Warning] (lib/serial_hw_int_cts.jal) [Line 357]  boolean expression 
>>> expected
>>> [Error] (lib/serial_hw_int_cts.jal) [Line 357]  'then' expected (got 
>>> 'serial_overflow_discard')
>>> [Warning] (lib/serial_hw_int_cts.jal) [Line 357]  boolean expression 
>>> expected
>>> Compiler CommandLine:  C:\JALPack2\compiler\jalv2.exe 
>>> "G:\Project\PCB\Temp\Temp_JAL_2\Temp_A_1\A7_USART\A7_1.jal" -s 
>>> "C:\JALPack2\lib" -no-variable-reuse  
>>>
>>> Errors :3       Warnings :1
>>>
>>> ‪majid ebru‬‏ در تاریخ سه‌شنبه ۲۰ آوریل ۲۰۲۱ ساعت ۱۹:۴۰:۱۱ (UTC+4:30) 
>>> نوشت:
>>>
>>> Thank you very very much to answer
>>>
>>> i attache two pic program 
>>>
>>> i read your update
>>>
>>> [email protected] در تاریخ سه‌شنبه ۲۰ آوریل ۲۰۲۱ ساعت ۱۸:۵۹:۴۴ 
>>> (UTC+4:30) نوشت:
>>>
>>> Hi Majid
>>>
>>> I find the code difficult to read and you are doing too much here. 
>>>
>>> Some observations:
>>>
>>>    - You include the same library more than once, you should not do 
>>>    that.
>>>    - The serial interrupt routine is part of the library so you do not 
>>>    need it here
>>>    - Your program uses an interrupt routine so you expect that it is 
>>>    called becauses there is an interrupt routine in the serial library but 
>>>    this is not a good practice. 
>>>    
>>> I do not know if it is your intention to do stuff in an interrupt 
>>> routine otherwise I would just move it to the main loop and put the check 
>>> (this is not a wait) using '  if serial_hw_read(your_data)' in your main 
>>> program.
>>>
>>> I did some cleanup of your program but since I do not understand what 
>>> you are trying to achieve it might be wrong.
>>>
>>> Kind regards,
>>>
>>> Rob
>>>
>>> ------------------------------
>>> *Van:* [email protected] <[email protected]> namens majid 
>>> ebru <[email protected]>
>>> *Verzonden:* dinsdag 20 april 2021 15:23
>>>
>>> *Aan:* jallib <[email protected]>
>>> *Onderwerp:* Re: [jallib] How to send & receive data with interrupt in 
>>> RS232
>>> hi again 
>>> can any body say me what is my wrong??
>>>
>>>
>>> Compilation started at :4/20/2021 4:48:38 PM
>>> jal 2.4o (compiled May  8 2011)
>>> [Error] (lib/serial_hw_int_cts.jal) [Line 224]  "serial_ctsinv" not 
>>> defined
>>> [Error] (lib/serial_hw_int_cts.jal) [Line 224]  'end' expected (got 
>>> 'serial_ctsinv')
>>> [Error] (lib/serial_hw_int_cts.jal) [Line 224]  {IF starts at 
>>> C:\JALPack2\lib/serial_hw_int_cts.jal:214}
>>> [Error] (lib/serial_hw_int_cts.jal) [Line 224]  "serial_ctsinv" not 
>>> defined
>>> [Error] (lib/serial_hw_int_cts.jal) [Line 224]  'end' expected (got 
>>> 'serial_ctsinv')
>>> [Error] (lib/serial_hw_int_cts.jal) [Line 224]  {IF starts at 
>>> C:\JALPack2\lib/serial_hw_int_cts.jal:212}
>>> [Error] (lib/serial_hw_int_cts.jal) [Line 224]  "serial_ctsinv" not 
>>> defined
>>> [Error] (lib/serial_hw_int_cts.jal) [Line 224]  'end' expected (got 
>>> 'serial_ctsinv')
>>> [Error] (lib/serial_hw_int_cts.jal) [Line 224]  {procedure starts at 
>>> C:\JALPack2\lib/serial_hw_int_cts.jal:206}
>>> [Error] (lib/serial_hw_int_cts.jal) [Line 224]  "serial_ctsinv" not 
>>> defined
>>> [Error] (lib/serial_hw_int_cts.jal) [Line 224]  unexpected token: 
>>> "serial_ctsinv"
>>>
>>> Thank you 
>>>
>>> -- 
>>> 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/d03b52e4-da68-46ce-873a-7849b0d3b697n%40googlegroups.com
>>>  
>>> <https://groups.google.com/d/msgid/jallib/d03b52e4-da68-46ce-873a-7849b0d3b697n%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/bbb797c2-641c-4c1c-be65-24bf65a0da56n%40googlegroups.com
>>>  
>>> <https://groups.google.com/d/msgid/jallib/bbb797c2-641c-4c1c-be65-24bf65a0da56n%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/c0334024-6744-41b3-bb06-d66203c01960n%40googlegroups.com
>>>  
>>> <https://groups.google.com/d/msgid/jallib/c0334024-6744-41b3-bb06-d66203c01960n%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/e94ade86-b2ec-484e-8876-8dd1eb62ba4fn%40googlegroups.com.

Reply via email to