Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

PSoC™ Creator & Designer Forum Discussions

Anonymous
Not applicable
how to assign the values for the buttons and the sliders, while using the PSoC--CY8C20534  for e.g.  void display_update_LEDs(BYTE sensor_state) {          LED_0_Switch( (sensor_state & 0x02) );     LED_1_Switch( (sensor_state & 0x04) );     LED_2_Switch( (sensor_state & 0x08) );
   
}
   
    
please explain me the coding below----  //Set port drive modes for LEDs
   
  PRT0DM0 |= 0b00100010;  //strong on P0[5],P0[1]
   
  PRT0DM1 &=~0b00100010;
   
  PRT1DM0 |= 0b10100100;  //strong on P1[2]
   
  PRT1DM1 &=~0b10100100;
   
    
   
PRT2DM0 |= 0b10100000;  //strong on P2[5],P2[7]
   
  PRT2DM1 &=~0b10100000;
   

Regards--

   

Amit

0 Likes
6 Replies
ETRO_SSN583
Level 9
Level 9
100 sign-ins 5 likes given 1000 replies posted

The PRTxDM0 & PRTxDM1 register sets the drive mode of a pin in

   

a specific port.

   

 

   

The code is to set and clear bits in the two registers to set the

   

drive mode of a specific pin in a specific port.

   

 

   

It looks like PRT0 and PRT2 are done right, but PRT1 comments

   

one pin is being set when in fact it is touching 3 pins.

   

 

   

Look at the register TRM for definitions for these registers. I show

   

DM0, you should also look at DM1.

   

 

   

0 Likes
ETRO_SSN583
Level 9
Level 9
100 sign-ins 5 likes given 1000 replies posted

Pic attached.

0 Likes
Anonymous
Not applicable
thanks Dana, I got the use of the two regi. DM0 & DM1. right now I'm using it as the follow-    void display_update_LEDs(BYTE sensor_state) {          LED_0_Switch( (sensor_state & 0x02) );     LED_1_Switch( (sensor_state & 0x04) );     LED_2_Switch( (sensor_state & 0x08) );     LED_2_Switch( (sensor_state & 0x10) );     LED_2_Switch( (sensor_state & 0x01) );
   
}  in this I'm getting the buttons sesing right, but what I haven't got is placing of those values
   
for e.g.  0x02,  0x04,  0x08,  0x10 etc, how to assign the values for the buttons and the sliders, while using the PSoC--CY8C20534
   

-----

   

Amit

0 Likes
ETRO_SSN583
Level 9
Level 9
100 sign-ins 5 likes given 1000 replies posted

Those values correspond to the pin in a port.

   

 

   

So -

   

 

   

0x01     Pin 0

   

0x02     Pin 1

   

0x04     Pin 2

   

0x08     Pin 3

   

0x10     Pin 4

   

0x20     Pin 5

   

0x40     Pin 6

   

0x80     Pin 7

   

 

   

Regards, Dana.

0 Likes
Anonymous
Not applicable

Hi Dana, I tried your suggestios but the are not working. I think its something about the raw count.

   

can you explain me this RAW COUNT thing.

   

I'm using the instruction

   

                                           WORD sensor_raw_count;

   

is it the same or else, please explain.

   

----

   

Amit

0 Likes
ETRO_SSN583
Level 9
Level 9
100 sign-ins 5 likes given 1000 replies posted

This ap note discusses raw count -

   

 

   

www.google.com/url

   

 

   

Regards, Dana.

0 Likes