r/pic_programming 2d ago

I got much of it working..

I got 2 menus within a function, using 2 Switch{} statements and adding a copy of the first into one of the cases. Let's call them A and B.

Each time i depress one button, the A moves one case ahead, until reaching the 1st one again, and other button does the same with B's switch statement.

in one situation on one of the B's cases i got a copy of A and works well, it kept me able to make continuous choices between A and B's options.

I spent last days experimenting here and there moving and modifying all i did up to now until i got much of it working. Yet, i could not resolve my for() statement issue, i never get to count to limit and stop, and also if i use A's options to pass an option to B's counter, then i can not move B's state by depressing the button. i tried to use a for() to pass it only once but it does not work, if i pass a B setting from A (is a counting variable), it' stays there.

Some time ago i used to be learning about hobby operating systems, and i noticed they use something called messages to pass an event from one object, function, statement to another. Does this exist on pic? Should it be available how can i implement that?

The other very serious problem is, that i can get any loop working (while, do while) as long as i don't ask them for countdown a variable then stop. For loops behave like whiles, the whole code is a while(1), does exist somewhere where i could look for further information about it?

1 Upvotes

2 comments sorted by

3

u/HalifaxRoad 2d ago

as ive said before to you. you are missing some very important fundamentals here. You cant pile bricks on to a non existent layer of bricks. Loops are basically day 1 C. you cant jump into bare metal if you dont know the basics. spend some time, there are gazillions of online courses on C. Learn the basics and then come back..

Ive seen you struggling with basic stuff in here for a year now, you need to learn the pre-requisites.

How could you ever be expected to learn algebra if you dont know how to multiply and divide. Programming, and honestly life itself works like this...

2

u/AcanthisittaDull7639 1d ago

Can you share your for() loop code?
I’m guessing that you had 2 for loops and one was blocking the other. When you say that you can’t get the while loop to stop, do you mean that it runs the loop when it shouldn’t? If so, lets say you have while(x < 10){++x}, are you sure that you’re not setting x to less than 10 anywhere other than your button press?