View Single Post
  #1   Spotlight this post!  
Unread 13-01-2004, 18:09
misterikkit's Avatar
misterikkit misterikkit is offline
will code for food
AKA: Jon B
#0258 (Sea Dawgs)
Team Role: Programmer
 
Join Date: Dec 2003
Location: San Jose, CA
Posts: 7
misterikkit will become famous soon enoughmisterikkit will become famous soon enough
Send a message via AIM to misterikkit
Question Trouble with pwm outputs

We're having a hard time with pwm outputs in the default code.

We assign an 8-bit value to, say, pwm02, and then printf pwm02. The output looked like gibberish, but when we printf-ed it in binary format, the 8-bit value was in the high byte of the value.

We've tried various methods of casting, shifting, and other wierd things, all to no avail. (see some examples below) Can anyone help?
Code:
	pwm02 = (unsigned char)Get_Analog_Value(rc_ana_in01)>>2;
	printf("%d\n",  pwm02);
	// output: 10496


Thanks in advance,
Jon B (: