Question about using pointers etc...

General discussion on mikroC.
Post Reply
Author
Message
LittleGreenBear
Posts: 3
Joined: 19 May 2005 21:29

Question about using pointers etc...

#1 Post by LittleGreenBear » 19 May 2005 21:41

Hello there!

MikroC is super! I used to always say why use anything else then ASM,
and also used to code all in ASM. The feeling to loose control over the chip and the registers and not knowing what is going on when using other languages always kept me...Now I have been trying MikroC for about 2 days, and I really love it!

Anyway, my question...How can I use pointers to output a string constant?

I want something like this:

Code: Select all

const someText = "This Is Some Text";

DoSome(){
   WriteToLCD(someText);      // Here must be pointed to the constant
}

void main(){

   DoSome();

}
I'd like to know how to declare the constant text part,
and also how to declare the function 'WriteToLCD()' as in my example.
so that I can pass through the address of the textstring, and use it in my function.

I will be using a lot of texts, so I'd like to be able to put it into the ROM rather then the RAM ;)

Thanks for any help , I am a bit newbee on C...

Regards,

pizon
mikroElektronika team
Posts: 823
Joined: 11 Oct 2004 08:53

Re: Question about using pointers etc...

#2 Post by pizon » 20 May 2005 12:14

1. Read about the LCD library in Help file (this is a MUST).
2. Take a look at the LCD example in the 'Examples' folder.
3. Having to display a lot of text means it's better for you to use the const arrays, so take a look at the post: http://www.mikroe.com/forum/viewtopic.php?p=7985
pizon

Post Reply

Return to “mikroC General”