Would you like to react to this message? Create an account in a few clicks or log in to continue.

You are not connected. Please login or register

8051 - 7 segment Counter

2 posters

Go down  Message [Page 1 of 1]

18051 - 7 segment Counter Empty 8051 - 7 segment Counter Tue Sep 26, 2023 1:21 pm

royqh1979



A simple 8051 7 Segments Counter.

Only runs on versions after R1928.
8051 - 7 segment Counter Snap127
Attachments
8051 - 7 segment Counter Attachment02-counter.zip
You don't have permission to download attachments.
(5 Kb) Downloaded 17 times

MedTronic likes this post

28051 - 7 segment Counter Empty Re: 8051 - 7 segment Counter Sat Nov 11, 2023 9:10 am

MedTronic



royqh1979 wrote:A simple 8051 7 Segments Counter.

Only runs on versions after R1928.
8051 - 7 segment Counter Snap127

very good example but can you please explain this command

P2_0 = (pos & 0x1)?1:0;
at line 15
what is ( ?:1:0 ) mean?

38051 - 7 segment Counter Empty Re: 8051 - 7 segment Counter Sun Nov 12, 2023 11:33 pm

MedTronic



No answer
i found it ...

Programmers use the ternary operator " ? "for decision making in place of longer if and else conditional statements.

The ternary operator take three arguments:

1- The first is a comparison argument
2- The second is the result upon a true comparison
3- The third is the result upon a false comparison

It helps to think of the ternary operator as a shorthand way or writing an if-else statement.

Syntax

condition ? value_if_true : value_if_false

The statement evaluates to value_if_true if condition is met, and value_if_false otherwise.

Best Regards
MedTronic

arcachofo likes this post

Sponsored content



Back to top  Message [Page 1 of 1]

Permissions in this forum:
You cannot reply to topics in this forum