Thread: Hyperterminal and MPLAB in C

  1. #16
    Registered User
    Join Date
    Mar 2011
    Posts
    546
    my mistake! thanks. never knew you could do that.
    edit: does stdio output block the main loop if the uart is polled? or is there a queuing mechanism?

  2. #17
    TEIAM - problem solved
    Join Date
    Apr 2012
    Location
    Melbourne Australia
    Posts
    1,907
    For the C18 compiler, the print uses the vfprintf function with a vargs list.

    The vfprintf uses the putc function for each byte generated (after processing the string) - This can take a little time, but it's quite efficient in going through the input string and substituting %_ for the variables.

    The putc function will use either the _usart_putc or _user_putc, depending on what stream is chosen

    As I said earlier, the _user_putc is user defined, so you can make it "non-blocking"

    However (in the case of the microcontrollers that I work with), you would probably want to make your usart/uart blocking, because you should never write while the Transmit Shift Register is not empty - You will lose data.

    For USART1 on a PIC18, you'd want to do something like this...
    Code:
    /* Wait for USART to be free... */
    while (!TXSTAbits.TRMT)
    {
      continue;
    }
    
    /* Send data */
    TXREG1 = data;
    Fact - Beethoven wrote his first symphony in C

  3. #18
    TEIAM - problem solved
    Join Date
    Apr 2012
    Location
    Melbourne Australia
    Posts
    1,907
    I suppose that you could make a buffer and send one byte say, every, millisecond via a timer interrupt until the buffer was empty

    That would be non-blocking.
    Fact - Beethoven wrote his first symphony in C

  4. #19
    Registered User
    Join Date
    Feb 2013
    Posts
    30
    No I do not have any background in this at all. It's called an "experience task" so I am getting the experience, I just wanted to better understand.

  5. #20
    TEIAM - problem solved
    Join Date
    Apr 2012
    Location
    Melbourne Australia
    Posts
    1,907
    Quote Originally Posted by tzzr101 View Post
    No I do not have any background in this at all. It's called an "experience task" so I am getting the experience, I just wanted to better understand.
    The great thing about microchip is the application notes.

    http://ww1.microchip.com/downloads/e...eDoc/usart.pdf
    Fact - Beethoven wrote his first symphony in C

  6. #21
    Registered User
    Join Date
    Feb 2013
    Posts
    30
    OK thank you "Click here." How would that code look however? I am assuming I am not using the correct configuration as it is probably set to default. So I guess my question is can you give me a sample of the format used?

  7. #22
    TEIAM - problem solved
    Join Date
    Apr 2012
    Location
    Melbourne Australia
    Posts
    1,907
    Quote Originally Posted by tzzr101 View Post
    OK thank you "Click here." How would that code look however? I am assuming I am not using the correct configuration as it is probably set to default. So I guess my question is can you give me a sample of the format used?
    Found using Google. Search string: p33FJ256GP710 sample code UART
    http://homepage3.nifty.com/ARTWEB/pi...03-0030301c1.c
    Fact - Beethoven wrote his first symphony in C

  8. #23
    Registered User
    Join Date
    Dec 2012
    Posts
    307
    //edit//
    was gong to fix the typos, but figured i would just keep going!!! so types stays!


    i am sorry, but when i ask my interns and people that work for me to do an "experience task" it is to jusdge the experience they SAID they had. Seems to me, from a professional standpoint mind you, that there expectations for you from what your resume said, seems to be too high to reach. ANYONE with even the simplest electronics class (mind you PIS`s are not on the simple classes list) are taught that you need to reference the datasheet and all other materials supplied by the manufacturer to learn the specs, the capibilities, and of course the "test" circuits and sample programming for that specific PIC. The fact that it has been said MANY MANY times since your first post to "check the datasheets" as well as a simple google search to show you how to combine the PIC and datasheet info for the programming. I would just tell your boss that you have NO CLUE how to do any of it. Atleast programming wise. Now i wonder, have you even used a PIC before? wired a circuit? anything? sorry if i sound like an ass, but the market around me is flooded with people with so called "degrees" and "certs" and of course "real world experiance", yet it is rare for me to find someone who even has a clue how to read a program, or a schematic, let alone get a PIC make a circuit, Program the PIC (not even going to get into how to write a boot code for a PIC), and then make it all work with the interface. It kills me even more to realize that they pay the schools 10`s of thousands of dollars to learn and be qualified, get the degree, then fail. And in the end i am stuck paying people for work, they said they could do, i paid them to do, just to find out i wasted time, and money in hiring them, and of course waiting on a product that will never happen. Once again sorry for being an ass, but IF you ever become a boss of technology, you will understand!

  9. #24
    TEIAM - problem solved
    Join Date
    Apr 2012
    Location
    Melbourne Australia
    Posts
    1,907
    Quote Originally Posted by tzzr101
    sorry I am literally brand new to programming yesterday...


    I want to simply be prompted and then give it an integer for it to evaluate just to show my bosses that I can communicate with the microcontroller via hyperterminal prior to the full programming process...


    I just started using C...


    It's called an "experience task" so I am getting the experience...

    I think that you are probably working outside your major - That is ok, it's quite common to be hired outside your major. I have a degree in Electronic Engineering. I got the job programming a microcontroller because I desplayed a good ability to learn and they needed someone with knowledge in Electronics.


    You have done the right thing asking for help - When confronted with programming for the first time (let alone programming a microcontroller) it can be overwhelming: You need to be reminded of all the tools that you have available; such as Google, Application notes, C standards, and datasheets.


    Crossfire - Your concern about the quality of graduates is not unjustified. There have been lots of concern with regards to Universities changing to Java and the minimising of critical thinking. Have you ever read the link at the bottom of Salem's posts "if at first you don't succeed..."?
    Fact - Beethoven wrote his first symphony in C

  10. #25
    Registered User
    Join Date
    Dec 2012
    Posts
    307
    my generation was if at first you dont succeed, do it again,

    todays generation, if at first you dont succeed, get all PC and complain about how your offended that you failed, start a court case against those that said you failed, the teachers that taught you cause it is there fault you failed, start a protest group on how society failed you, go to a shrink and tell him how everyone upset you, then go on xanax and live on disability because school taught you that nothing in life should upset you, and that there is no such thing as failure......

    Welcome to real life!

  11. #26
    TEIAM - problem solved
    Join Date
    Apr 2012
    Location
    Melbourne Australia
    Posts
    1,907
    Quote Originally Posted by Crossfire View Post
    my generation was if at first you dont succeed, do it again,

    todays generation, if at first you dont succeed, get all PC and complain about how your offended that you failed, start a court case against those that said you failed, the teachers that taught you cause it is there fault you failed, start a protest group on how society failed you, go to a shrink and tell him how everyone upset you, then go on xanax and live on disability because school taught you that nothing in life should upset you, and that there is no such thing as failure......

    Welcome to real life!
    It sounds to me like you have a biased opinion about young people
    Fact - Beethoven wrote his first symphony in C

  12. #27
    Registered User
    Join Date
    Dec 2012
    Posts
    307
    not young people, society in general now days. PC has gone overboard. like the posts on facebook......"in my day we didnt have all the warnings we do now, because we were no ........ing morons"

    as well as one of the tags on here, and sorry if i cant remember who it is but it says something about "its a race of programmers and idiots, and the idiots winning"

    schools teach to what is on the test, teach what to think, not teach HOW to think, or HOW to reason, or HOW to reasearch.

    society has become VERY lazy!

    There is ALOT of young people that dont follow this mold, but the majority seems to always stick out!"its a race of programmers and idiots, and the idiots winning"
    Last edited by Crossfire; 02-18-2013 at 05:17 PM.

  13. #28
    Registered User
    Join Date
    May 2009
    Posts
    4,183
    Quote Originally Posted by Crossfire View Post
    not young people, society in general now days. PC has gone overboard. like the posts on facebook......"in my day we didnt have all the warnings we do now, because we were no ........ing morons"

    as well as one of the tags on here, and sorry if i cant remember who it is but it says something about "its a race of programmers and idiots, and the idiots winning"

    schools teach to what is on the test, teach what to think, not teach HOW to think, or HOW to reason, or HOW to reasearch.

    society has become VERY lazy!

    There is ALOT of young people that dont follow this mold, but the majority seems to always stick out!"its a race of programmers and idiots, and the idiots winning"
    Maybe mine.

    Tim S.

    My signature for several months/years.

    "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to produce bigger and better idiots. So far, the Universe is winning." Rick Cook
    Last edited by stahta01; 02-18-2013 at 09:14 PM.

  14. #29
    Registered User
    Join Date
    Dec 2012
    Posts
    307
    yup it was yours!!! i couldnt remember who had it!!!

  15. #30
    Registered User
    Join Date
    Feb 2013
    Posts
    30
    Ah I see a lot of hate. I understand your frusterated with young programmers. I just need the help from older ones because I am only a second year and haven't taken a lick of programming. They wanted me to do this simply because they didn't have time. They told me to get on it and now I am making severe progress! The only problem is now I am writing to the SD card itself but it is unrecongnizable. So currently working through that with test code as well as a little of my own. So any help or suggestions would be great! Also my father complains about the same things, I mean I am awful with computers, never had one till I bought my laptop for school. So while I understand your assumptions that maybe I just want you to do it for me instead of learning and figuring it out myself. This equipment is very expensive and I value my internship not to mess it up and lose a possibly returning internship and hopefully a full time job because I was being careless. There's my rant!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 8
    Last Post: 08-02-2012, 06:15 PM
  2. how its done(hyperterminal)?
    By stefan63 in forum Windows Programming
    Replies: 17
    Last Post: 03-25-2011, 04:24 AM
  3. mplab ide
    By russ4789 in forum C Programming
    Replies: 0
    Last Post: 03-29-2009, 09:05 AM
  4. C30 Compiler for MPLAB
    By Dukefrukem in forum C Programming
    Replies: 1
    Last Post: 11-08-2007, 07:40 PM
  5. Hyperterminal????
    By gvector1 in forum C# Programming
    Replies: 3
    Last Post: 01-22-2004, 08:54 PM

Tags for this Thread