Author Topic: little querry to get an output to flip/flop  (Read 14274 times)

0 Members and 1 Guest are viewing this topic.

Offline SimonTopic starter

  • Global Moderator
  • *****
  • Posts: 17816
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
little querry to get an output to flip/flop
« on: October 10, 2011, 11:58:52 am »
So I have a project I am already using the PWM output but i need another oscillating output that is no available on the pic I'm using. The program will run in a cycle that coincides with each PWM cycle so I had a thought, using basic as the language, have a "bit" type variable and add 1 to it each time I get round to "that" line of the program, in this way I should get a 0 1 0 1 0 1 0 1..... output, right ? or is there another way of doing it with complicated program lines, I just need a toggling output, frequency and duty are not much of a problem.
 

Offline Jimmy

  • Regular Contributor
  • *
  • Posts: 224
  • Country: au
Re: little querry to get an output to flip/flop
« Reply #1 on: October 10, 2011, 12:09:03 pm »
You will have to turn it on and off you can turn it on at the beginning and off half way through your program to output what you want 
 

Offline SimonTopic starter

  • Global Moderator
  • *****
  • Posts: 17816
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: little querry to get an output to flip/flop
« Reply #2 on: October 10, 2011, 12:14:52 pm »
I could do, i just wondered if I had a single bit variable 0 = 0, 0+1=1, 1+1=0, 0+1=1 etc
 

Offline joelby

  • Frequent Contributor
  • **
  • Posts: 634
Re: little querry to get an output to flip/flop
« Reply #3 on: October 10, 2011, 12:19:19 pm »
Can you use a byte type and invert it each time, and then use the lowest bit (foo & 0x01)? You could increment a byte variable too, but using an adder seems like overkill for just toggling a bit.
 

Online jimmc

  • Frequent Contributor
  • **
  • Posts: 304
  • Country: gb
Re: little querry to get an output to flip/flop
« Reply #4 on: October 10, 2011, 12:44:24 pm »
Exclusive OR with a '1' in the bit position you want to toggle will toggle the bit as you require.

Jim
 

Offline SimonTopic starter

  • Global Moderator
  • *****
  • Posts: 17816
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: little querry to get an output to flip/flop
« Reply #5 on: October 10, 2011, 12:47:08 pm »
I think the timed set or reset bit program lines will be simpler, silly thought I can up with over lunch
 

Offline PeterG

  • Frequent Contributor
  • **
  • Posts: 831
  • Country: au
Re: little querry to get an output to flip/flop
« Reply #6 on: October 10, 2011, 12:59:55 pm »
I could do, i just wondered if I had a single bit variable 0 = 0, 0+1=1, 1+1=0, 0+1=1 etc

Wich BASIC language are you using?
Proton?

Regards
Testing one two three...
 

Offline SimonTopic starter

  • Global Moderator
  • *****
  • Posts: 17816
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: little querry to get an output to flip/flop
« Reply #7 on: October 10, 2011, 01:00:46 pm »
mikroe-basic, I keep vowing to learn C but just never find the time
 

Offline PeterG

  • Frequent Contributor
  • **
  • Posts: 831
  • Country: au
Re: little querry to get an output to flip/flop
« Reply #8 on: October 10, 2011, 01:06:10 pm »
ok, i am thinking you have a few options.

Instead of using +1, i would use NOT to flip the bit.
The timing can be handled by either the pics timer or use a pair of Delay statements.

Regards
Testing one two three...
 

Offline SimonTopic starter

  • Global Moderator
  • *****
  • Posts: 17816
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: little querry to get an output to flip/flop
« Reply #9 on: October 10, 2011, 01:17:29 pm »
ah yes that will do it nicely
 

Offline Mechatrommer

  • Super Contributor
  • ***
  • Posts: 11639
  • Country: my
  • reassessing directives...
Re: little querry to get an output to flip/flop
« Reply #10 on: October 10, 2011, 04:49:32 pm »
mikroe-basic, I keep vowing to learn C but just never find the time
why dont you go direct to asm? C is "harder" than asm, much things are out of your control, just like basic. and asm is much closer relation with the mcu. people may argue :P
Nature: Evolution and the Illusion of Randomness (Stephen L. Talbott): Its now indisputable that... organisms “expertise” contextualizes its genome, and its nonsense to say that these powers are under the control of the genome being contextualized - Barbara McClintock
 

Offline SimonTopic starter

  • Global Moderator
  • *****
  • Posts: 17816
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: little querry to get an output to flip/flop
« Reply #11 on: October 10, 2011, 04:51:52 pm »
mikroe-basic, I keep vowing to learn C but just never find the time
why dont you go direct to asm? C is "harder" than asm, much things are out of your control, just like basic. and asm is much closer relation with the mcu. people may argue :P

 It is because of a number of assholes on another forum insisting that asm which i could not master was the only way and that nearly put me off electronics all together and caused a 2 year delay in my achieving anything in microcontrollers !
 

Offline cyberfish

  • Regular Contributor
  • *
  • Posts: 240
  • Country: gb
Re: little querry to get an output to flip/flop
« Reply #12 on: October 10, 2011, 07:53:22 pm »
Quote
why dont you go direct to asm? C is "harder" than asm, much things are out of your control, just like basic. and asm is much closer relation with the mcu. people may argue :P
ASM is suitable for some jobs, but for 95% of other things, C is much more suitable.

ASM makes introducing bugs easier, takes a lot longer to write, and the code a lot harder to read and maintain. Don't use ASM unless necessary.
 

Online IanB

  • Super Contributor
  • ***
  • Posts: 11890
  • Country: us
Re: little querry to get an output to flip/flop
« Reply #13 on: October 10, 2011, 08:23:14 pm »
why dont you go direct to asm? C is "harder" than asm, much things are out of your control, just like basic. and asm is much closer relation with the mcu.
This is a crazy opinion.  :o

Quote
people may argue :P
Indeed they may.   ???
 

Online IanB

  • Super Contributor
  • ***
  • Posts: 11890
  • Country: us
Re: little querry to get an output to flip/flop
« Reply #14 on: October 10, 2011, 08:26:18 pm »
So I have a project I am already using the PWM output but i need another oscillating output that is no available on the pic I'm using. The program will run in a cycle that coincides with each PWM cycle so I had a thought, using basic as the language, have a "bit" type variable and add 1 to it each time I get round to "that" line of the program, in this way I should get a 0 1 0 1 0 1 0 1..... output, right ? or is there another way of doing it with complicated program lines, I just need a toggling output, frequency and duty are not much of a problem.
The simplest idiom in a language like BASIC is this:

Code: [Select]
x = 0
while (forever)
  x = 1 - x
end
 

Offline SimonTopic starter

  • Global Moderator
  • *****
  • Posts: 17816
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: little querry to get an output to flip/flop
« Reply #15 on: October 10, 2011, 08:51:58 pm »
The usual argument is that asm is faster, well my little 12F micro @ 4MHz can keep up with a car engine and more running a basic program so I can't see why i need asm in there
 

Online Zero999

  • Super Contributor
  • ***
  • Posts: 19523
  • Country: gb
  • 0999
Re: little querry to get an output to flip/flop
« Reply #16 on: October 10, 2011, 09:24:02 pm »
On the PC, I found assembly easier to learn than C which just made me want to give up.

I've used BASIC before but never on an MCU.

I've only done a little programming on MCUs and used assembler which I found quite straightforward.
 

Offline Bored@Work

  • Super Contributor
  • ***
  • Posts: 3932
  • Country: 00
Re: little querry to get an output to flip/flop
« Reply #17 on: October 10, 2011, 10:00:45 pm »
On the PC, I found assembly easier to learn than C which just made me want to give up.

And why do you think that single data point, if true, is sufficient to generalize?
I delete PMs unread. If you have something to say, say it in public.
For all else: Profile->[Modify Profile]Buddies/Ignore List->Edit Ignore List
 

Online Zero999

  • Super Contributor
  • ***
  • Posts: 19523
  • Country: gb
  • 0999
Re: little querry to get an output to flip/flop
« Reply #18 on: October 10, 2011, 10:32:18 pm »
On the PC, I found assembly easier to learn than C which just made me want to give up.

And why do you think that single data point, if true, is sufficient to generalize?
I'm not.
 

Online IanB

  • Super Contributor
  • ***
  • Posts: 11890
  • Country: us
Re: little querry to get an output to flip/flop
« Reply #19 on: October 11, 2011, 02:10:56 am »
If you "understand" computer hardware then assembly is easy (if tedious); otherwise it is not. However, C is like high level assembly, so if you don't "understand" computer hardware at an intuitive level then C is also hard to learn. On the other hand if you are comfortable with assembly then programming in C should be like a walk in the park.

BASIC is in a different language family, quite deliberately so. Computers are supposed to be labour saving devices, and if BASIC saves on labour compared to C then  program in BASIC and be happy!
 

Online Psi

  • Super Contributor
  • ***
  • Posts: 9951
  • Country: nz
Re: little querry to get an output to flip/flop
« Reply #20 on: October 11, 2011, 02:16:57 am »
Programming windows apps in C  is much harder than C programming for a microcontroller.

The Windows API is full of objects, structures and weird callback routenes which can be very annoying to get your head arround when starting out.
You end up writing lots of boring API code just to 'tell' windows to create you a form.
Of course modern IDE's often generate a lot of that code for you, so it's not too bad, but the code is still visible in your editior and gets in the way of following your actual code logic.

When coding a microcontroller in everything is so much simpler. There is no OS API to interface with (unless you create one).
Microcontroller code is normally quite easy to read and understand, even if you have limited skills in the language.
After all, an IF and a LOOP is pretty easy to figure out in almost any language.
(The obvious exception is ASM, where you really have to know the language to be able to read it)

One thing you do need to understand when working with microcontrollers is bitwise operations and how use them. They're used far far more in microcontroller programming than windows programming.
« Last Edit: October 11, 2011, 02:29:58 am by Psi »
Greek letter 'Psi' (not Pounds per Square Inch)
 

Offline Mechatrommer

  • Super Contributor
  • ***
  • Posts: 11639
  • Country: my
  • reassessing directives...
Re: little querry to get an output to flip/flop
« Reply #21 on: October 11, 2011, 02:23:20 am »
here we go again
It is because of a number of assholes on another forum insisting
i'm not insisting, its just only suggestion since the OP did mention vb vs c
Nature: Evolution and the Illusion of Randomness (Stephen L. Talbott): Its now indisputable that... organisms “expertise” contextualizes its genome, and its nonsense to say that these powers are under the control of the genome being contextualized - Barbara McClintock
 

Offline SimonTopic starter

  • Global Moderator
  • *****
  • Posts: 17816
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: little querry to get an output to flip/flop
« Reply #22 on: October 11, 2011, 05:40:22 am »
well I'm not sure how C compares to BASIC, I thought it was about as easy/hard to learn, maybe not ?
 

Offline Mechatrommer

  • Super Contributor
  • ***
  • Posts: 11639
  • Country: my
  • reassessing directives...
Re: little querry to get an output to flip/flop
« Reply #23 on: October 11, 2011, 06:03:48 am »
same
Nature: Evolution and the Illusion of Randomness (Stephen L. Talbott): Its now indisputable that... organisms “expertise” contextualizes its genome, and its nonsense to say that these powers are under the control of the genome being contextualized - Barbara McClintock
 

Online IanB

  • Super Contributor
  • ***
  • Posts: 11890
  • Country: us
Re: little querry to get an output to flip/flop
« Reply #24 on: October 11, 2011, 06:09:05 am »
well I'm not sure how C compares to BASIC, I thought it was about as easy/hard to learn, maybe not ?
BASIC was designed to make it easy to get results out of a computer--designed help make writing programs fast and convenient. There have been many varieties of BASIC since the first one but all of them have had the same philosophy, a classic example being Microsoft Visual Basic. Visual Basic is the archetypal "get results fast" language.

On the other hand C was designed to get "close to the metal". Everything about the language was intended to give you complete and full control over the hardware at the level of pointers, memory and data bits. It was intended to let you write every program you could write in assembly, only more easily.

So easy/hard to learn is relative, but I would have to say in general that BASIC is easier to learn than C.
 

Offline joelby

  • Frequent Contributor
  • **
  • Posts: 634
Re: little querry to get an output to flip/flop
« Reply #25 on: October 11, 2011, 06:17:16 am »
The main good thing about C is that it is usually very portable, whereas BASIC isn't standardised and varies between implementations.

If you're careful about how you code (generally by abstracting device-specific functions), the same C can run on a PIC, an AVR, an MSP430, and a desktop computer. It can be much faster to prototype an algorithm on a PC, since there's no upload step, and you can use advanced debuggers.

Recently I was writing a small program for an MSP430 Launchpad and started to run in to size limitations with the device I had on hand, and it was only about a 30 minute job to convert the lot for a PIC, and most of this was looking at the data sheets and figuring out how to set up peripherals the same way. The bulk of the code didn't require any changes at all. Try doing that with assembler!

If speed is your primary concern, pretty much all C compilers will allow you to add inline assembly.
 

Offline Mechatrommer

  • Super Contributor
  • ***
  • Posts: 11639
  • Country: my
  • reassessing directives...
Re: little querry to get an output to flip/flop
« Reply #26 on: October 11, 2011, 09:25:33 am »
The bulk of the code didn't require any changes at all. Try doing that with assembler!
i'm currently building my own asm library so my pic code will be portable to avr. yes its a PITA.

If speed is your primary concern, pretty much all C compilers will allow you to add inline assembly.
i still dont have full control of what register should i use if say, i'm inlining from inside a "for" loop. since the loop will use some registers in the chip for background task such counting etc. if the IDE documentation is detailed about that, then no problem.
Nature: Evolution and the Illusion of Randomness (Stephen L. Talbott): Its now indisputable that... organisms “expertise” contextualizes its genome, and its nonsense to say that these powers are under the control of the genome being contextualized - Barbara McClintock
 

Online Zero999

  • Super Contributor
  • ***
  • Posts: 19523
  • Country: gb
  • 0999
Re: little querry to get an output to flip/flop
« Reply #27 on: October 11, 2011, 05:09:16 pm »
On the other hand if you are comfortable with assembly then programming in C should be like a walk in the park.
I hated the way C used braces all the time, the way it's case sensitive and missing odd characters out stopped it from compiling. I couldn't stand the string functions and the way it insists on zero terminated strings. If I want to worry about low level stuff then I'd use assembly, if I just want an easy to use high level language I'd use BASIC.

I haven't had any experience with high level languages on MCUs so I can't comment. I may even give C another go.
 

Offline SimonTopic starter

  • Global Moderator
  • *****
  • Posts: 17816
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: little querry to get an output to flip/flop
« Reply #28 on: October 11, 2011, 05:22:36 pm »
Well I tyink for the minute I'm stuck on BASIC, I'm not the best at programming so I suppose it meets my inabilities best at the moment, I spend so much time on projects that I have no time to learn a massive chunk like another programming language
 

Online IanB

  • Super Contributor
  • ***
  • Posts: 11890
  • Country: us
Re: little querry to get an output to flip/flop
« Reply #29 on: October 11, 2011, 05:23:26 pm »
I hated the way C used braces all the time, the way it's case sensitive and missing odd characters out stopped it from compiling. I couldn't stand the string functions and the way it insists on zero terminated strings.
Uh huh. You have to get the "logic" behind the design of C before you can feel comfortable with it, and that does take a bit of time to learn. The raw and low level nature of C is one of the things that motivated the introduction of C++.

Quote
If I want to worry about low level stuff then I'd use assembly, if I just want an easy to use high level language I'd use BASIC.
Quite. And that's exactly how things were for many years in the era of Z80 and 6502 based home computers.
 

Offline jahonen

  • Super Contributor
  • ***
  • Posts: 1054
  • Country: fi
Re: little querry to get an output to flip/flop
« Reply #30 on: October 11, 2011, 07:40:18 pm »
I hated the way C used braces all the time

I guess you don't then want to try LISP (Lots of Irritating Superfluous Parenthesis) :) Not exactly a microcontroller programming language but anyway. Curly braces of C (or C++) is nothing in comparison.

I wonder, what fundamentally prevents BASIC being equally efficient than C if both are compiled code. After all, many equivalent constructs can be done with either language. ASM is more efficient if you know the processor better than the compiler.

But then, why use ASM when you can code the whole application using HDL and do everything in parallel, now that is really efficient and fast ;)

Regards,
Janne
 

alm

  • Guest
Re: little querry to get an output to flip/flop
« Reply #31 on: October 11, 2011, 08:41:51 pm »
I wonder, what fundamentally prevents BASIC being equally efficient than C if both are compiled code. After all, many equivalent constructs can be done with either language. ASM is more efficient if you know the processor better than the compiler.
I'm not that familiar with embedded BASIC dialects, but there may be some minor issues. Like the non-shortcircuiting behavior of boolean operators (leading to cludges like AndAlso/OrElse in some dialects). Or bounds checking. Or if it uses Pascal strings (Hero999 complained about null-terminated strings, so I'm just guessing), most strings operations carry an overhead because the length has to be updated after the fact. The main thing is probably the amount of money and time the industry spends optimizing the compilers. There's a lot of money behind embedded C, every MCU vendor tries to get good compiler support. BASIC appears to be mainly confined to hobbyists, I've never seen a micro vendor advertise a new line as being supported by some BASIC compiler.

But then, why use ASM when you can code the whole application using HDL and do everything in parallel, now that is really efficient and fast ;)
Hand-optimized transistor layouts avoids the overhead of HDL, allows you to fit more functionality on the same piece of silicon and is easier because you're dealing directly with hardware, and avoid learning the abstraction of a HDL.
 

Offline Mechatrommer

  • Super Contributor
  • ***
  • Posts: 11639
  • Country: my
  • reassessing directives...
Re: little querry to get an output to flip/flop
« Reply #32 on: October 11, 2011, 09:26:54 pm »
basic is good at language (human friendly) but poor at mathematics. i think its possible to optimize basic performance, a new language maybe, hybrid of basic and c. if someone pay me a very good money, i will invent the compiler.  :-X
« Last Edit: October 11, 2011, 09:33:29 pm by Mechatrommer »
Nature: Evolution and the Illusion of Randomness (Stephen L. Talbott): Its now indisputable that... organisms “expertise” contextualizes its genome, and its nonsense to say that these powers are under the control of the genome being contextualized - Barbara McClintock
 

Offline SimonTopic starter

  • Global Moderator
  • *****
  • Posts: 17816
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: little querry to get an output to flip/flop
« Reply #33 on: October 11, 2011, 09:39:45 pm »
basic is good at language (human friendly) but poor at mathematics. i think its possible to optimize basic performance, a new language maybe, hybrid of basic and c. if someone pay me a very good money, i will invent the compiler.  :-X

why not invent the compiler and then sell it ;) why work for someone else when you can work for yourself
 

alm

  • Guest
Re: little querry to get an output to flip/flop
« Reply #34 on: October 11, 2011, 11:08:01 pm »
Great, another programming language, just what the world desperately needs ;).
 

Offline PeterG

  • Frequent Contributor
  • **
  • Posts: 831
  • Country: au
Re: little querry to get an output to flip/flop
« Reply #35 on: October 12, 2011, 02:03:56 am »
I have been using Proton BASIC for PIC for years. It allows me to rapidly develop a simple pic app with the flexibility of inline ASM if i need it. I view C compilers as midway between BASIC and ASM, its not as easy as BASIC but its not as tight as ASM either.

Just my 2 cents.
Testing one two three...
 

Offline jahonen

  • Super Contributor
  • ***
  • Posts: 1054
  • Country: fi
Re: little querry to get an output to flip/flop
« Reply #36 on: October 12, 2011, 05:27:06 am »
But then, why use ASM when you can code the whole application using HDL and do everything in parallel, now that is really efficient and fast ;)
Hand-optimized transistor layouts avoids the overhead of HDL, allows you to fit more functionality on the same piece of silicon and is easier because you're dealing directly with hardware, and avoid learning the abstraction of a HDL.

Sorry, I completely forgot that one. It is just AFAIK large majority of digital ASICs are designed using a HDL. But of course, I guess one can draw own transistors if HDL feels too bloated.

It reminds me that I must respect the pioneers who designed 6800, 6502 etc. by pencil and paper, without any kind of HDL. They must have known their stuff.

Regards,
Janne
 

Offline Mechatrommer

  • Super Contributor
  • ***
  • Posts: 11639
  • Country: my
  • reassessing directives...
Re: little querry to get an output to flip/flop
« Reply #37 on: October 12, 2011, 07:39:41 am »
basic is good at language (human friendly) but poor at mathematics. i think its possible to optimize basic performance, a new language maybe, hybrid of basic and c. if someone pay me a very good money, i will invent the compiler.  :-X
why not invent the compiler and then sell it ;) why work for someone else when you can work for yourself
because its not fun. i can live with either asm, C or basic.

Great, another programming language, just what the world desperately needs ;).
the idea is to combine the strong points of every languages and put the weaknesses aside. not creating a new language. maybe the language is still looks like basic, but the way it compiles is like C.

anyway. have you guys use a feature in C/C++ IDE for mcu where when you compiled your c code, you are able to see the generated asm for which line in the c code?
Nature: Evolution and the Illusion of Randomness (Stephen L. Talbott): Its now indisputable that... organisms “expertise” contextualizes its genome, and its nonsense to say that these powers are under the control of the genome being contextualized - Barbara McClintock
 

Online Zero999

  • Super Contributor
  • ***
  • Posts: 19523
  • Country: gb
  • 0999
Re: little querry to get an output to flip/flop
« Reply #38 on: October 13, 2011, 06:15:02 pm »
One idea is to start with a very high language such as BASIC, then converting it to C, which is in turn compiled to assembly and assembled. You could then use either of the three in the same program. I can't remember the compiler but I know this has been done before for the PC. I don't know about MCUs.
 

Offline SimonTopic starter

  • Global Moderator
  • *****
  • Posts: 17816
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: little querry to get an output to flip/flop
« Reply #39 on: October 19, 2011, 06:40:45 am »
well you can put assembly inline into Mikroe basic
 

Offline Mechatrommer

  • Super Contributor
  • ***
  • Posts: 11639
  • Country: my
  • reassessing directives...
Re: little querry to get an output to flip/flop
« Reply #40 on: October 19, 2011, 07:28:51 am »
well you can put assembly inline into Mikroe basic
asm will do its magic if your doing loop'ed routine. but if you just want to turn on and off something and go back to (basic or C) loop, then not much different there. and maybe other misunderstood, asm is all about manipulating registers, gathered together to create one logical statement or task. we have to think "procedurally", not "logically". so as we usually take for granted the formula such as a = b + c, in asm we need to do it in several lines. eg into something like mov a, reg1 ... mov b, reg2 ... add reg1, reg2 ... mov reg2, a. so all those lines will have the same meaning as a single line statement in C/basic, infact this is what happen in reverse once our C/basic code is translated into machine code (except more bloated if the compiler is not as intelligent as its creator). once we grasp the idea of asm is about manipulating registers (and memory etc), other than difficulty understanding the mcu datasheet and its memory structure, i dont see any reason why asm is so difficult.

but from proffesional point of view, the issue like portability and development time will be an issue, esp for large program. but sure there's a way. i've just completed my simple asm library that can work on both pic and avr. so when i code my app in asm, it will closely resemble higher level language (by encapsulating weird keywords/opcodes) but with the efficiency of raw asm, and work for both pic and avr with minor modification. well since i've coded for pic and i've found out the chip cannot do the job, i've to port my app without having to rebuild the logic again from scratch in avr. but i dont say asm is the only way. if in the future i will have to do more advance/complex project, i will certainly pick C or basic in the 1st place, esp when its involving device library from 3rd party or more complex logic flow. but when it comes to only generating PWM or LED on off, asm makes wonder.... for me ;)
Nature: Evolution and the Illusion of Randomness (Stephen L. Talbott): Its now indisputable that... organisms “expertise” contextualizes its genome, and its nonsense to say that these powers are under the control of the genome being contextualized - Barbara McClintock
 

Offline SimonTopic starter

  • Global Moderator
  • *****
  • Posts: 17816
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: little querry to get an output to flip/flop
« Reply #41 on: October 19, 2011, 06:12:12 pm »
well really it needs a proper resource to actually explain how to put a program together step at a time. I have never found that, all tutorials do is explain some limited code and leave you in the dark about the rest.
 

Offline Mechatrommer

  • Super Contributor
  • ***
  • Posts: 11639
  • Country: my
  • reassessing directives...
Re: little querry to get an output to flip/flop
« Reply #42 on: October 19, 2011, 07:00:46 pm »
Nature: Evolution and the Illusion of Randomness (Stephen L. Talbott): Its now indisputable that... organisms “expertise” contextualizes its genome, and its nonsense to say that these powers are under the control of the genome being contextualized - Barbara McClintock
 

Offline SimonTopic starter

  • Global Moderator
  • *****
  • Posts: 17816
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: little querry to get an output to flip/flop
« Reply #43 on: October 19, 2011, 09:39:01 pm »
yes the datasheet only lists the mnemonics, not how to write a program
 

Online IanB

  • Super Contributor
  • ***
  • Posts: 11890
  • Country: us
Re: little querry to get an output to flip/flop
« Reply #44 on: October 19, 2011, 10:00:06 pm »
yes the datasheet only lists the mnemonics, not how to write a program
How to write a program is "deeper knowledge" that is outside the scope of a datasheet.

Ironically, how to write a program at the machine code level was a standard part of O-Level (later GCSE) computer science when I was at school in the 70's. At the time the world of computers was a different place, and what we today would think of as a microcontroller was just an ordinary computer back then with similar power. The teaching syllabus went through all the basics of program counter, registers, memory addressing, stack operations and other hardware details, and there were a whole variety of simple machine emulators to write and test programs on. This was of course complementary to writing bigger and more functional programs in BASIC, which was the standard educational language in schools at the time.

These days I don't know whether GCSE computer science even touches much on programming in high level languages, let alone machine code. I suspect it's based much more around PCs and desktop applications along with more general theory. There were of course no PCs in the 70's unless you count machines like the Commodore PET or Tandy TRS-80, and applications like word processing or spreadsheets were barely emerging concepts.

Getting back on subject, try looking for some basic machine code or assembly programming tutorials on the web. Once you get the idea in general, you can transfer the concepts to any particular machine you come across, be it a PIC or an AVR.
« Last Edit: October 19, 2011, 10:01:38 pm by IanB »
 

Offline Mechatrommer

  • Super Contributor
  • ***
  • Posts: 11639
  • Country: my
  • reassessing directives...
Re: little querry to get an output to flip/flop
« Reply #45 on: October 19, 2011, 11:34:01 pm »
i did some exercise sometime ago with my students to program with punch/hole card, guess for what? blinking tungsten bulb :D
Nature: Evolution and the Illusion of Randomness (Stephen L. Talbott): Its now indisputable that... organisms “expertise” contextualizes its genome, and its nonsense to say that these powers are under the control of the genome being contextualized - Barbara McClintock
 

Online Zero999

  • Super Contributor
  • ***
  • Posts: 19523
  • Country: gb
  • 0999
Re: little querry to get an output to flip/flop
« Reply #46 on: October 20, 2011, 05:00:10 pm »
These days I don't know whether GCSE computer science even touches much on programming in high level languages, let alone machine code. I suspect it's based much more around PCs and desktop applications along with more general theory. There were of course no PCs in the 70's unless you count machines like the Commodore PET or Tandy TRS-80, and applications like word processing or spreadsheets were barely emerging concepts.
Yes, when I studied GCSE IT back in the 90s it was mostly geared to databases with some spreadsheets. There was a little BASIC programming but it wasn't a module in itself, we just had to write fragments of code as part of the database or spreadsheet.

I can't speak for today's GCSE course as I did it over 12 years ago. I imagine there's probably more web design nowadays.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf