Jump to content

sparkyb

Members
  • Content Count

    2
  • Joined

  • Last visited

Community Reputation

0 Neutral

About sparkyb

  • Rank
    Newbrie
  1. I would like to know if there is a way, or request there be a way to directly test a pin. Someone has suggested the macro: #define test_pin(port,pin) (port & (1<<pin)) This works except the code it generates is very inefficent. As an example, if (intcon & (1<<T0IF) ) { clear_bit(intcon,T0IF); } generates: ;;;;;;;; if (intcon & (1<<0x0002) ) { movf _intcon, W andlw D'4' sublw 0 btfsc STATUS, Z goto label_0018 ;;;;;;;; clear_bit(intcon,0x0002); bcf _intcon, D'2' label_0018 when it would be much simpler to do this: ;;;;;;;; if (intcon[T0IF] ) { btfss _intcon, 2 goto label_0018 ;;;;;;;; clear_bit(intcon,0x0002); bcf _intcon, D'2' label_0018 Is there anyway to generate this simpler conditional code?
  2. Does anyone know how to generate a random number with c2c? all I need to do is generate a small integer at most between 0 and 7.
×
×
  • Create New...