Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
cMIPS
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Harbor Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Strozzi
cMIPS
Commits
a996f5b7
There was a problem fetching the pipeline summary.
Commit
a996f5b7
authored
9 years ago
by
Strozzi
Browse files
Options
Downloads
Patches
Plain Diff
Fix main to final version \(\!\?\)
parent
e731c9c4
No related branches found
No related tags found
No related merge requests found
Pipeline
#
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
cMIPS/include/main.c
+49
-10
49 additions, 10 deletions
cMIPS/include/main.c
with
49 additions
and
10 deletions
cMIPS/include/main.c
+
49
−
10
View file @
a996f5b7
#include
<stdio
.h
>
#include
"cMIPS
.h
"
#include
"vetorFib.h"
#include
"vetorFib.h"
#define MAXPOW 7
#define MAXPOW 7
typedef
struct
UARTdriver
{
int
rx_hd
;
// reception queue head index
int
rx_tl
;
// reception queue tail index
char
rx_q
[
16
];
// reception queue
int
tx_hd
;
// transmission queue head index
int
tx_tl
;
// transmission queue tail index
char
tx_q
[
16
];
// transmission queue
int
nrx
;
// number of characters in rx_queue
int
ntx
;
// number of spaces in tx_queue
}
UARTdriver
;
extern
UARTdriver
Ud
;
int
Strlen
(
char
*
c
)
int
Strlen
(
char
*
c
)
{
{
int
i
=
0
;
int
i
=
0
;
while
(
c
[
i
++
]);
while
(
c
[
i
++
]
-
10
);
return
i
-
1
;
return
i
-
1
;
}
}
...
@@ -51,21 +63,48 @@ int int2hex(char *c, int i)
...
@@ -51,21 +63,48 @@ int int2hex(char *c, int i)
c
[
j
++
]
=
'a'
+
(
val
-
10
);
c
[
j
++
]
=
'a'
+
(
val
-
10
);
p
/=
16
;
p
/=
16
;
}
}
c
[
j
]
=
0
;
c
[
j
]
=
1
0
;
return
j
-
1
;
return
j
-
1
;
}
}
int
main
()
int
main
()
{
{
char
n
[
16
],
f
[
16
];
char
n
[
16
],
f
[
16
],
c
;
int
fib
;
int
fib
,
j
,
s
;
while
(
scanf
(
"%s"
,
n
)
&&
n
[
0
])
{
// trocar scanf por getc()
while
(
1
)
{
j
=
0
;
while
((
n
[
j
++
]
=
getFila
())
!=
'\n'
);
n
[
j
]
=
'\n'
if
(
n
[
0
]
==
10
)
// critério de fim de transmissão
break
;
fib
=
hex2int
(
n
);
fib
=
hex2int
(
n
);
if
(
fib
<
BUF_SZ
)
{
if
(
fib
<
BUF_SZ
)
{
fib
=
buf
[
fib
];
fib
=
buf
[
fib
];
int2hex
(
f
,
fib
);
s
=
int2hex
(
f
,
fib
);
//retorna strlen de f
printf
(
"%d(%s)
\n
"
,
fib
,
f
);
// trocar printf por putc()
for
(
j
=
0
;
j
<
s
;
j
++
)
}
else
putc
(
f
[
j
]);
printf
(
"Valor fora dos limites!
\n
"
);
}
else
{
to_stdout
(
'v'
);
to_stdout
(
'a'
);
to_stdout
(
'l'
);
to_stdout
(
'o'
);
to_stdout
(
'r'
);
to_stdout
(
' '
);
to_stdout
(
'm'
);
to_stdout
(
'u'
);
to_stdout
(
'i'
);
to_stdout
(
't'
);
to_stdout
(
'o'
);
to_stdout
(
' '
);
to_stdout
(
'g'
);
to_stdout
(
'r'
);
to_stdout
(
'a'
);
to_stdout
(
'n'
);
to_stdout
(
'd'
);
to_stdout
(
'e'
);
to_stdout
(
'\n'
);
}
}
}
// sleep??
return
0
;
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment