1 slave 1 master 1 MAX232 1 problem ?


Closed Thread
Results 1 to 20 of 20
  1. #1
    Join Date
    May 2005
    Posts
    49

    Question 1 slave 1 master 1 MAX232 1 problem ?

    hi everybody i am trying to get numbers from PC in my circuit i have 1 slave 1 master and a MAX232 i can communicate pic to pic well there is no problem i can sent numbers to pc it is well too but when i am trying to get numbers from PC i have problem. i Try these

    test var byte
    TEST =0

    loop:
    hserin [test]
    if test=4 then goto msj
    if test=5 then goto msj2
    msj:
    hserout ["msj alındı",13,10]
    goto loop
    msj2:
    hserout ["tamamdır",13,10]
    goto loop
    end

    in here i try everything but when i sent the msj from pc i allways get "msj alındı" it means i cant use comparision.I know i can sent number from pc coz i try this code too.

    test var byte
    TEST =0

    loop:
    hserin [test]
    hserout [#test,13,10]
    goto loop
    end

    it send me back what i sent that means no circuit problem i have programming problem can anybody show me my problem and solition.?
    Asking is not a shame but not learning is a SHAME!!!

  2. #2
    Join Date
    Feb 2004
    Location
    Germany
    Posts
    762


    Did you find this post helpful? Yes | No

    Default

    SubZero,

    please do some searching on the Forum.

    there are tons of examples like: http://www.picbasic.co.uk/forum/show...78&postcount=1

    And:

    <img src=http://www.picbasic.co.uk/forum/attachment.php?attachmentid=379&stc=1>
    Last edited by NavMicroSystems; - 30th July 2005 at 14:28.
    regards

    Ralph

    _______________________________________________
    There are only 10 types of people:
    Those who understand binary, and those who don't ...
    _______________________________________________



  3. #3
    bot402's Avatar
    bot402 Guest


    Did you find this post helpful? Yes | No

    Default

    were you born ignorant or is it something you've learnt over time.

    The image not only breaks all the rules of any forum, but is also extremely offensive and should be removed as soon as possible.

  4. #4
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,614


    Did you find this post helpful? Yes | No

    Wink

    Hi, Bot

    Sooooo ... how would you tell someones their lazy student questions are more than boring ...???

    mmmmmmhhh , I open wide my little laughy brown eyes, and don't tell me they are blue, at this time !!!

    Alain

    PS: Hi, Nav

    you're on the right tracks ...

    Alain, moderator somewhere else ...
    Last edited by Acetronics2; - 30th July 2005 at 14:51.

  5. #5
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    SubZero...

    Try this... and then I want you to send a number 4 from your PC's keyboard... and then I want you to send an UPPERCASE 'A'... and see what happens... (try it also with a lowercase 'a')...
    Code:
    	test var byte
    
    loop:
    	hserin [test]
    	if test=52 then 
    		HSEROUT ["I've struck Gold",13,10]
    		else
    		If test=65 then
    			HSEROUT ["Hey it's really working",13,10]
    			else
    			HSEROUT ["No Cigar",13,10]
    			endif
    		endif
    	goto Loop
    	end
    And now your homework (and please, NOBODY, but NOBODY give the answer here!)... I want you to find out WHY when you send a "4" from your PC's keyboard, we look for a 52 here in the PIC program. And when you send an Uppercase A we look for a 65 (and that is the BIGGEST clue you're going to get!). Question 1. What is the relationship? Question 2. What number would you need to detect, if we wanted to capture the lowercase 'a' instead of the UPPERCASE 'A'? By answering those two questions you will have learnt the answer to your original problem (as well as looking at your logical program flow to the flaws in your original program).

  6. #6
    Join Date
    Mar 2005
    Location
    Iowa, USA
    Posts
    216


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Acetronics
    Sooooo ... how would you tell someones their lazy student questions are more than boring ...???
    Well, I don't think he's lazy. Sure, he could of done some searching to find his answer, but I know how frustrating it can be to try to find something and no matter how you search, you just come up blank. I think Melanie is on the right track here. Give a man a fish he'll eat for a day, show a man how to fish, he'll eat the rest of his life.... or something like that. Honestly... we have got to have better responses than RTFM!

  7. #7
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    Bot

    I do have to agree with the others... in that over the last weeks the questions from many newbies are the kind that are answered in the opening pages of the manuals. There's been some real classics this week (why can't I make my Hindustan Tourer go as fast as G8RPI's rocket)... I've had to take a real deep intake of breath and IGNORE them (depite the fact they even PM or EMAIL me as well!). I've been sorely tempted to reply that you've joined the wrong class... Landscape Gardening 101 is down the hall on the right...

    The REAL question that needs to be addressed is... how do you get folks to READ the manual, the README files, the DATASHEET, the HELP files (if there are any - and you know what I'm referring to here), search this list, search the email archives on the manufactuers site, all the myriad of documentation that you and I use every day? A lot of folks on this list (and I'm sure on the other) won't. They're too lazy. They can't be bothered to make the slightest effort (and it's plainly obvious from some questions posted), and it's easier to have someone else do their homework for them.

    I think, some patience, and when these silly questions appear, those that have the inclination should simply post a reference to the Page or Section Number in the manual where the answer is to be found. This forces them to look for it and digest what they're reading. Garbo Technician 101 still has vacancies...

    To preserve Freedom of Speech yet retaining some moderation, the offending image has been edited. Sorry about that Ralph, but I did use my best lipstick pencil to do the job.

  8. #8
    Join Date
    May 2005
    Posts
    49


    Did you find this post helpful? Yes | No

    Exclamation Answer to all......

    First i am not a lazy student also i am not a student!!!
    I am trying to learn how to use pic in PBP.
    I am a machine engineer.Not an electronik engineer.In the picture 2 u can see a machine that i do.And in picture 4 u can see how many books i read about pic 2 of them is a translation of PIC BASIC PRO.(picture 5) in picture 1 u can see i have a little room for pic and programming.Nobody helps me when i am trying to learn micros.

    Answer to NavMicroSystem:1 year before u were not answering u were asking everything that u wonder or can't do.I am asking only what i can't do.
    And nobody is putting a gun on to u re head to answer.It is u re chose to answer or not.Thats why this is a forum.

    To others exept melanie:No body learn pic programming in their moms abdomen.All of u learn pic like me.And a little answer to the people that is asking me did u search hserin yes i search http://www.picbasic.co.uk/forum/sear...searchid=45608
    and read all of them may be answer is there but i can't see

    And to the Melanie :Thank u Melanie u re trying to teach something first i want to answer u re question.When i sent 4 it becomes 52 that means pc sent a number in diffrent way that i don't know.If somebody teach me i will be really glad.I am not trying to use the easy way like the others think i am only trying to learn.I don't want an answer like
    question=how can i light a led on port a?
    answer=high porta.0
    I am not looking answers like that i am looking answers that will teach me how to do.

    Thanks to all for u re kind answers....
    Attached Images Attached Images     
    Asking is not a shame but not learning is a SHAME!!!

  9. #9
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    I'll lead you by the hand on this...

    If you type a number 4 on the PC (eg Hyperterminal), it sends a character, but it doesn't send a numeric value of 4 as you expect, it sends something quite different...

    Do you have a BASIC Interpreter on your PC (like GWBasic or QBasic or VisualBasic)?

    Find out what happens when you do this...

    Print asc("4")

    and then this...

    Print chr$(52)

    what appears on your screen?

    Look up what the ASC instruction does in BASIC (I'm not taking about PIC BASIC here but a BASIC that you can run on your PC). The ASC instruction will lead you to understaning the relationship between a string "4" and a numeric decimal 52. It will lead you to a TABLE of CODES... this table cross-references numeric values with displayable values... I'm trying hard not to give you the name of this table, that is for you to find out and tell me.

    Now I know you say that "Read the Manual" is my answer to everything, but I'm insisting that you go to the MeLabs website, and download the latest manual. The TABLE of CODES are in an Appendix in the BACK OF THE MANUAL. Look for it.

    I've also looked at your pictures... I'll guarantee this code table will be found in every one of your PICBasic Books.

  10. #10
    Join Date
    May 2005
    Posts
    49


    Did you find this post helpful? Yes | No

    Wink Thanks Melanie now i understand.

    Yes i have visual basic 6.0 professional now i understan what u mean.
    Communication between pic and PC is a table of ASCII characters.I understand they re communicating not like as i think.For exmp when i am trying to sent 1 from pc to pic it sents 49 decimal number or 31 hex.If i try to compare numbers useing if i have to look 49 for 1 not look 1 then it will fail.
    Asking is not a shame but not learning is a SHAME!!!

  11. #11
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    Exactly! Now you can also understand the example code I posted.

    You can always convert numbers from ASCII to numeric decimal...

    So... in the example with the test variable, if you take the ASCII number and subtract 48, you will be left with the Decimal Numeric Value (but this is only valid for numbers).

    Look at my new example...
    Code:
    	test var byte
    
    loop:
    	hserin [test]
    	test=test-48
    	if test=4 then 
    		HSEROUT ["I've struck Gold",13,10]
    		else
    		HSEROUT ["No Cigar",13,10]
    		endif
    	goto Loop
    	end

  12. #12
    Join Date
    May 2005
    Posts
    49


    Did you find this post helpful? Yes | No

    Red face yes melanie but another how.

    yes now i do the same.But i don't understan 1 think.Now i can sent 1 digit numbers how can i sent 2 digit numbers?
    for example when i sent 15 it comes to pic 49 53.i try to use this code
    HSERİN [STR test\2]
    if test = 4953 then goto ok
    goto loop
    ok:
    HSEROUT ["OK MAN U DID IT!",13,10]
    goto loop
    end

    it will not work i know coz test is a byte that can't get numbers more than 255 if i make test a word PBP gives error i use str =string but it accepts charakters like a,b,c not numbers than what must i do ?
    test var byte[2] means 2 value but how can i put 2 value to pic?
    Last edited by SuB-ZeRo; - 30th July 2005 at 21:44. Reason: forgot to say something
    Asking is not a shame but not learning is a SHAME!!!

  13. #13
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    test(0) holds the first ASCII digit (tens) = example 49
    test(1) holds the second ASCII digit (units) = example 53

    Value var byte

    value=((test(0)-48)*10)+(test(1)-48)

    value using our example ASCII 49 53 will be decimal 15.

    If 'value' is likely to be bigger than 255, then it'll have to be a word.

    You now have the knowledge... be creative...

    I recon the hood in your avatar is stopping you seeing the big picture... lose the hood, buy a crate of beer...

  14. #14
    Join Date
    May 2005
    Posts
    49


    Did you find this post helpful? Yes | No

    Red face ok it's working

    test var byte
    test2 var byte
    value var byte
    loop:
    hserin [test,test2]
    value=((test-48)*10)+(test2-48)
    if value=15 then
    goto ok
    else
    goto fail
    endif
    goto loop
    ok:
    hserout ["you did it!",13,10]
    goto loop
    fail:
    hserout ["U re an idiot",13,10]
    goto loop
    end
    now did it and after i see u re code test(0) means 1 number.(0) useing this is a litle bit same like useing index in visual basic right?
    Asking is not a shame but not learning is a SHAME!!!

  15. #15
    Join Date
    Feb 2004
    Location
    Germany
    Posts
    762


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Melanie
    To preserve Freedom of Speech yet retaining some moderation, the offending image has been edited. Sorry about that Ralph, but I did use my best lipstick pencil to do the job.
    Mel,
    I'm sorry,
    but is wrong with telling someone to Read The Fantastic Manual(s) ??

    However,
    if people feel better now we can leave it.
    regards

    Ralph

    _______________________________________________
    There are only 10 types of people:
    Those who understand binary, and those who don't ...
    _______________________________________________



  16. #16
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    Actually, I didn't think they were particularly Fantastic, which is why the 'F' is crossed out.

  17. #17
    Join Date
    Feb 2004
    Location
    Germany
    Posts
    762


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Melanie
    Actually, I didn't think they were particularly Fantastic, which is why the 'F' is crossed out.
    OK, and since they aren't funny either. . .

    I'm glad to hear you didn't have any other association with that letter . . .
    regards

    Ralph

    _______________________________________________
    There are only 10 types of people:
    Those who understand binary, and those who don't ...
    _______________________________________________



  18. #18
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Read Those Friendly Manual
    Return To Fundamental Manual
    Remind That Friend Martin
    Ralph's Try to Fire Melanie ... no i don't think so
    Ralph's Tired about Fellows Misunderstanding

    Just kidding Ralph !!!
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  19. #19
    Join Date
    May 2005
    Posts
    49


    Did you find this post helpful? Yes | No

    Wink To my misunderstand friend Ralph

    Ralph i learn electronic by my self.That means i really don't know what will i do when i have problem.I learn to read manuels and datasheet from this site.But some times i really can't find the answers.I am reading the manuels and try to make what i understand from the manuel.And all the manuels in english.In my first threads i wrote "My english is not good" if the manuels writen in Turkish may be i will understand better.In my dictionarys sometimes i can't find the translation of the thecnical words beleave me i really want to be a man who is not asking but can write some answers to the others.If u want to learn am i saying true or lie u can enter to the google and search my name "Burak Küçükdere".U will find some forum sites that i answer so many questions abouth Visual Basic.I am not a man who is asking free answers i always want to know what was my problem and how can i resolve.None of my questions re my homework you will see in the future i will become a man who is answering to the newbies who is learning pic basic or micros.
    Last edited by SuB-ZeRo; - 31st July 2005 at 22:47.
    Asking is not a shame but not learning is a SHAME!!!

  20. #20
    Join Date
    Feb 2004
    Location
    Germany
    Posts
    762


    Did you find this post helpful? Yes | No

    Default

    Sub,

    look at your signature:

    Asking is not a shame but not learning is a SHAME!!!
    Please read the FAQ's, ReadMe's, Datasheets and Manuals
    and try to learn from it.

    Also Search the Forum,
    many questions have already answered more than once.

    And last but not least:
    See: THIS
    regards

    Ralph

    _______________________________________________
    There are only 10 types of people:
    Those who understand binary, and those who don't ...
    _______________________________________________



Similar Threads

  1. My code for TV remote and MIBAM for RGB control
    By idtat in forum Code Examples
    Replies: 4
    Last Post: - 12th January 2013, 20:52
  2. Delayed output 10 secs
    By lilimike in forum mel PIC BASIC Pro
    Replies: 37
    Last Post: - 14th October 2011, 06:28
  3. first project, and yes, doesn`t work
    By bogdan in forum mel PIC BASIC Pro
    Replies: 15
    Last Post: - 28th April 2009, 06:13
  4. DS1820 headache
    By Calco in forum mel PIC BASIC Pro
    Replies: 11
    Last Post: - 12th August 2004, 00:28
  5. New member
    By jmgelba in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 28th February 2004, 22:44

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts