program doesn't exit setup() and begin loop()

While troubleshooting, I noticed that my program doesn't seem to be able to transition between setup() and loop(). I have a line of code that turns on an LED; if I place this line as the LAST line of setup() it runs, but if it is the FIRST line of loop() it does not run. Does anyone know why this might be happening?

works:

int p = 9; //LED pin
int b = 128; //LED brightness

void setup() {
  Serial.begin(9600);
  pinMode(p, OUTPUT);
  digitalWrite(p, b);
}

void loop() {
  //digitalWrite(p, b);
...

doesn't work:

int p = 9; //LED pin
int b = 128; //LED brightness

void setup() {
  Serial.begin(9600);
  pinMode(p, OUTPUT);
  //digitalWrite(p, b);
}

void loop() {
  digitalWrite(p, b);
...

Does anyone know why this might be happening?

Without seeing all of your code? Not a clue.

Using digitalWrite(), the second argument is supposed to be HIGH or LOW. 128 is neither.

as far as analogWrite() vs. digitalWrite(), that's just an oversight. It works enough to see whether the code is running. The point is that in the second example, the code never even runs. I'm looking to see if the problem is in the code presented and I'm just missing it.

The code "presented" doesn't compile, so cannot run, so cannot be said to work or not work, and the chances of anyone replicating your results are zero

the chances of anyone replicating your results are zero

I tried. It didn't work. 8)

Obviously the code presented is incomplete. I'm just wondering if there is some known reason why loop() wouldn't run.

I'm just wondering if there is some known reason why loop() wouldn't run.

Yes, there is.