CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Problem with 74165

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Skirmitt



Joined: 19 May 2009
Posts: 60

View user's profile Send private message

Problem with 74165
PostPosted: Tue Jan 17, 2012 8:15 am     Reply with quote

I'm doing a project (midi controller) that has 74165's in it. The code is supposed to send a code when a button states changes at the inputs of the 74165's.

Code:

int16 data=0;
int16 olddata=0;
int i=0;

int buttarr[];
int oldbuttarr[];


read_expanded_inputs (&data);
if(olddata != data)
{

for(i=0;i<=15;i++){
      buttarr[i] = bit_test (data,i);
     
      if(buttarr[i] != oldbuttarr[i]) midiout(144,i,buttarr[i]);
     
      oldbuttarr[i] = buttarr[i];
     
}
}
olddata = data;


74165 are well defined and wired correctly. I have 2 of them.

Problem is that it gives a state change in the code when there is none. Could there be something wrong with a bit mask ?

State change on one port:

Code:
 TIMESTAMP IN PORT STATUS DATA1 DATA2 CHAN NOTE EVENT               
   2100793  1  --    144     7     0    1  G -1 Note Off             
   2100794  1  --    144    11     1    1  B -1 Note On               
   2100795  1  --    144    12     1    1  C  0 Note On               
   2100796  1  --    144    13     1    1  C# 0 Note On               
   2100797  1  --    144    14     1    1  D  0 Note On               
   2100798  1  --    144    15     1    1  Eb 0 Note On               
   2101341  1  --    144     6     1    1  F#-1 Note On               
   2101342  1  --    144    11     1    1  B -1 Note On               
   2101343  1  --    144    12     1    1  C  0 Note On               
   2101344  1  --    144    13     1    1  C# 0 Note On               
   2101345  1  --    144    14     1    1  D  0 Note On               
   2101346  1  --    144    15     1    1  Eb 0 Note On               
Mike Walne



Joined: 19 Feb 2004
Posts: 1785
Location: Boston Spa UK

View user's profile Send private message

74165 circuit
PostPosted: Tue Jan 17, 2012 9:10 am     Reply with quote

You've not given me enough information.

I know it may seem silly but, can you provide a schematic of your 74165 arrangement, an indication of cable lengths to the 74165's, and just enough compilable code to reproduce the problem.

[I'm assuming you've got plenty of ceramic caps across supply rails.]

Mike
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group