IF statement Oddity (seems to me)

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

IF statement Oddity (seems to me)

1,381件の閲覧回数
UtopiaTim
Contributor III

Hi Folks,

 

I have a completed a couple of projects written in C, and I've come across something that

seems to be a bit strange to me.

 

I'm sure that it's probably something simple, but here goes.

 

This is what I would like to do:

 

unsigned char data;

.

.

.

  if (data == 0x0b){
     inhibit = 0;   
  }

 

Pretty simple.  If a location called 'data' is = to $0b, then make inhibit 0.

 

It doesn't <always> work.  I usually end up doing !=, then changing the

structure of the way the routine works.

 

I've seen this on the JM60 & QG8 versions of CW.  I'm using 6.1 currently.

 

Thanks,


Tim

ラベル(1)
0 件の賞賛
返信
2 返答(返信)

559件の閲覧回数
bigmac
Specialist III

Hello Tim,

 

You do not say whether data is a local variable or a global variable.  If a global variable, can the variable be written via an ISR?  If so, the variable definition should include the volatile modifier.

 

Regards,

Mac

 

0 件の賞賛
返信

559件の閲覧回数
UtopiaTim
Contributor III

Hi Mac,

 

Thanks for the reply.

 

Right now, I'm writing the code as a single module, and there are

no interrupts.  (it's a very simple project).

 

 

Tim

 

 

0 件の賞賛
返信