All About Circuits Forum  

Go Back   All About Circuits Forum > Software, Microcomputing, and Communications Forums > Programmer's Corner

Notices

Programmer's Corner Discussion forum for all aspects of programming and software engineering. Any software programming language welcome: C, C++, C#, Fortran, Java, Matlab, etc.

Reply   Post New Thread
 
Thread Tools Display Modes
  #1  
Old 10-12-2009, 01:52 AM
guilty guilty is offline
New Member
 
Join Date: Oct 2009
Posts: 1
Default need WinCUPL code help

hi, actually , i was a bit confused where to post this, but i decided to post it here in programming section because it is related to program code. so, admin, feel free to move it if this is in the wrong section.

so, here is my problem, i need to write a program for a counter, 5 bit MUX, and 5 bit DEMUX, and here is my code,

Code:
Name     lab 3.2 ;
PartNo   00 ;
Date     10/01/2009 ;
Revision 01 ;
Designer TEST  ;
Company  TEST ;
Assembly None ;
Location  ;
Device   G22V10 ;
/* *************** INPUT PINS *********************/
PIN 4    = A ; /*input1 mux*/  
PIN 5    = B ; /*input2 mux*/ 
PIN 6    = C ; /*input3 mux*/
PIN 7    = D ; /*input4 mux*/
PIN 8    = E ; /*input5 mux*/
PIN 9    = F ; /*input demux*/
PIN 10   = G ;/*selector 1*/
PIN 11   = H ; /*selector 2*/
PIN 13   = I ; /*selector 3*/
 

/* *************** OUTPUT PINS *********************/
PIN 17    = U ; /*output mux*/ 
PIN 18    = V ; /*output1 demux*/ 
PIN 19    = W ; /*output2 demux*/
PIN 20    = X ; /*output3 demux*/
PIN 21    = Y ; /*output4 demux*/
PIN 22    = Z ; /*output5 demux*/

/* *************** FLIP-FLOP ************************/
Pin 1 = clock;
Pin 2 = reset;
Pin 3 = preset;

Pin 14 = Q0; /*output of a flip-flop 1*/
pin 15 = Q1; /*output of a flip-flop 2*/
pin 16 = Q2; /*output of a flip-flop 3*/
/***************** EQUATIONS ***********/

/*** MUX ***/
U= (A &((G:0)&(H:0) & (I:0))) 
   # (B & ((G:0)& (H:0)& (I:1))) /*if F=0,G=0,H=1 then output O= input k*/
   # (C & ((G:0)& (H:1)& (I:0)))/*if F=0,G=1,H=0 then output O=input L*/
   # (D & ((G:0)& (H:1)& (I:1))) /*if F=0,G=1,H=1 then output O=input M*/
   # (E & ((G:1)& (H:0)& (I:0)));/*if F=1,G=0,H=0 then output O=input N*/


/*** DEMUX ***/
V = (F & ((G:0) & (H:0) & (I:0)));/*if F=0,G=0,H=0 then input I will be sent to output P*/
W = (F & ((G:0) & (H:0) & (I:1)));/*if F=0,G=1,H=0 then input I will be sent to output Q*/
X = (F & ((G:0) & (H:1) & (I:0)));
Y = (F & ((G:0) & (H:1) & (I:1)));
Z = (F & ((G:1) & (H:0) & (I:0)));
/***** 1 bit counter to be connected to selector (S) input *****/

field count = [Q2,Q1,Q0];
$define s0 'b'000/* define the values of the counter bit in */ 
$define s1 'b'001 /* each of the two counter states*/ 
$define s2 'b'010
$define s3 'b'011
$define s4 'b'100
count.ar = reset;  /*connect the reset input to counter reset*/ 
count.sp = preset;  /*connect the preset input to counter preset*/

sequenced count { /*describe the action of the state machine*/
 present s0 default next s1; /* if the current counter output = 0 then next output 1 */
 present s1 default next s2; /*if current counter output = 1 then next output 0*/
 present s2 default next s3;
 present s3 default next s4;
 present s4 default next s0;
}
Select All
it will be connected like this: 5 input to the MUX, all HIGH, and connect the output of the counter to be the selector for the MUX, and the output of the MUX goes to the input of the DEMUX, so, the all the output will be LOW except one HIGH. and the HIGH output will shift to another output one after another every time the clock is pulsed.

so, i just need to confirm if my code is correct or not... thanks in advance..
Reply With Quote
Reply   Post New Thread

Tags
,


Related Site Pages
Section Title
Worksheet Counters
Worksheet Flip-flop circuits
Worksheet Multiplexers and demultiplexers
Video Lecture Asynchronous Counters - Digital
Video Lecture Counters - Digital
Textbook Ring counters : Shift Registers
Textbook Parallel-in, parallel-out, universal shift register : Shift Registers
Textbook Serial-in/serial-out shift register : Shift Registers
Textbook Finite State Machines : Sequential Circuits Counters
Textbook Asynchronous flip-flop inputs : Multivibrators


Similar Threads
Thread Thread Starter Forum Replies Last Post
16f84 or 16f628 IR Code Redirect capelu Embedded Systems and Microcontrollers 0 08-29-2009 02:07 PM
PICStep/Linistepper/AVRSTMD Code in C or BASIC joprinz General Electronics Chat 1 03-29-2009 01:03 AM
PICStep/Linistepper/AVRSTMD Code in C or BASIC joprinz Programmer's Corner 0 03-29-2009 12:34 AM
PIC code help skuzzie Homework Help 3 03-02-2009 05:08 PM
WILL $$$$ PAY FOR HELP WRITING THIS PROGRAM !!!!!!!!!!! Z80 nocmsa Programmer's Corner 0 11-23-2008 03:40 AM

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 10:34 AM.


User-posted content, unless source quoted, is licensed under a Creative Commons Public Domain License.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.