Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

getch() pic

Status
Not open for further replies.

neelam29

New Member
hi all
want to read a string of message from modem to pic16f877
scanf isnt working.i think i will have to use getch();
can anybody help me out for how to use this function. i want to recive the message "hello" which my gsm has transmitted to pic.

how will it come to know that the string has ended and what is the method to use this getch() function?
 
neelam29 said:
hi all
want to read a string of message from modem to pic16f877
scanf isnt working.i think i will have to use getch();
can anybody help me out for how to use this function. i want to recive the message "hello" which my gsm has transmitted to pic.

how will it come to know that the string has ended and what is the method to use this getch() function?

hi,
I dont use C, but a Google for 'getch() function' gave lots of hits.

**broken link removed**
 
neelam29 said:
hi all
want to read a string of message from modem to pic16f877
scanf isnt working.i think i will have to use getch();
can anybody help me out for how to use this function. i want to recive the message "hello" which my gsm has transmitted to pic.

how will it come to know that the string has ended and what is the method to use this getch() function?
getch() does as defined - get one char, and you need an array to build your string 'hello,' which will be terminated with the nul char \0. You will need an array big enough to hold your string, plus one more bite for the nul, so to hold 'hello' you need myString[5] Don't forget that an array begins at 0, not 1, so
declare a byte as an index and loop through your array using something like:
while myString[index] not equal to '\0'
myString[index] = getch()

You should end up with something like: myString[0] = 'h', myString[1] = 'e' ... myString[5] =' \0'

edited for clarity
 
Last edited:
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top