Technical discussions about Freescale Microcontrollers: M68HC11. (Freescale Semiconductor is a Subsidiary of Motorola).
|
I am having some difficulty getting my code to execute with BUFFALO disabled. I am using an Adapt11C24DXEVB, and have my code loaded into the internal EEPROM starting at address B600. If I power up the board with BUFFALO enabled, and issue the go B600 command, everything works perfectly. However, if I then pull E0 high to disable buffalo, and reset the board, my program only runs until it tries to do an A/D conversion on port E7, where it hangs waiting for the conversion complete flag to be set. I am using the branch on bit clear command to loop back to itself until the flag is set, and am certain this command is correct both because I copied it from some code I have used before, and because, as I mentioned already, it DOES run properly when called from BUFFALO. If I replace the branch command with a delay loop that should be more than long enough for the conversions to complete (Y index register is decremented from $0700) program execution continues successfully past this point- except that the A/D conversion is never completed, which obviously causes the branches based on the result of the A/D conversion to branch improperly. Specifically, it always takes the branch for when the value is less than $41, while the actual value should be (and is when run from BUFFALO) close to or equal to $FF. I have already checked that I am setting the stack pointer ($CFFF) and enabling the interrupts (CLI), with no change. Can anyone tell me what I am missing here? Thanks. |
|
|
|
At 2004-11-29 02:11, Israel Brewster wrote: >I am having some difficulty getting my code to execute with BUFFALO disabled. I am using an >Adapt11C24DXEVB, and have my code loaded into the internal EEPROM starting at address >B600. If I power up the board with BUFFALO enabled, and issue the go B600 command, >everything works perfectly. However, if I then pull E0 high to disable buffalo, and reset the >board, my program only runs until it tries to do an A/D conversion on port E7, where it hangs >waiting for the conversion complete flag to be set. > >I am using the branch on bit clear command to loop back to itself until the flag is set, and am >certain this command is correct both because I copied it from some code I have used before, >and because, as I mentioned already, it DOES run properly when called from BUFFALO. If I >replace the branch command with a delay loop that should be more than long enough for the >conversions to complete (Y index register is decremented from $0700) program execution >continues successfully past this point- except that the A/D conversion is never completed, >which obviously causes the branches based on the result of the A/D conversion to branch >improperly. Specifically, it always takes the branch for when the value is less than $41, while >the actual value should be (and is when run from BUFFALO) close to or equal to $FF. > >I have already checked that I am setting the stack pointer ($CFFF) and enabling the interrupts >(CLI), with no change. Can anyone tell me what I am missing here? Thanks. Beware that the bitwise instructions were added to the 6811 instruction set by aliens from outer space and that they tend to use unexpected read-modify-write-cycles to get things done. That may upset registers in peripheral chips. Tip from a red blooded earthling (and compiler writer): Don't use the bit instructions! Because some hardware idiot thought it was doable to add a certain instruction, that doesn't mean it makes sense to use it! (Don't get me started on the 6812...) Greetings, Jaap -- Chip Directory -- http://www.chipdir.biz/ -- http://www.chipdir.info/ -- http://www.chipdir.net/ -- http://www.chipdir.nl/ -- http://www.chipdir.org/ -- And about 30 other mirror sites world-wide. -- -- To subscribe to a free 'chip issues, questions and answers' -- mailing list, send a message to with -- in the body 'subscribe chipdir-L'. About 500 experts are -- willing to think with you about electronics problems etc. |
|
|
|
I have used bit instructions quite frequently in my programing and found them to be a valuable tool, making my code much simpler and more compact - frequently doing in one line what would otherwise take four or five lines at least. Be that as it may, the problem here has nothing to do with the bit instruction- as I mentioned in my original post, I have tried replacing it with a simple delay loop. The problem is that with BUFFALO disabled, the A/D conversion never takes place. Thus the conversion complete flag is never set, and thus the bit instruction loops infinitely waiting for it to be set. This is shown by the behavior experienced when the bit instruction is replaced with a delay loop, as described in my original post. Thanks anyway. --- In , Jaap van Ganswijk <ganswijk@x> wrote: > At 2004-11-29 02:11, Israel Brewster wrote: > >I am having some difficulty getting my code to execute with BUFFALO disabled. I am using an > >Adapt11C24DXEVB, and have my code loaded into the internal EEPROM starting at address > >B600. If I power up the board with BUFFALO enabled, and issue the go B600 command, > >everything works perfectly. However, if I then pull E0 high to disable buffalo, and reset the > >board, my program only runs until it tries to do an A/D conversion on port E7, where it hangs > >waiting for the conversion complete flag to be set. > > > >I am using the branch on bit clear command to loop back to itself until the flag is set, and am > >certain this command is correct both because I copied it from some code I have used before, > >and because, as I mentioned already, it DOES run properly when called from BUFFALO. If I > >replace the branch command with a delay loop that should be more than long enough for the > >conversions to complete (Y index register is decremented from $0700) program execution > >continues successfully past this point- except that the A/D conversion is never completed, > >which obviously causes the branches based on the result of the A/D conversion to branch > >improperly. Specifically, it always takes the branch for when the value is less than $41, while > >the actual value should be (and is when run from BUFFALO) close to or equal to $FF. > > > >I have already checked that I am setting the stack pointer ($CFFF) and enabling the interrupts > >(CLI), with no change. Can anyone tell me what I am missing here? Thanks. > > Beware that the bitwise instructions were added to the 6811 > instruction set by aliens from outer space and that they > tend to use unexpected read-modify-write-cycles to get > things done. That may upset registers in peripheral chips. > > Tip from a red blooded earthling (and compiler writer): > Don't use the bit instructions! > > Because some hardware idiot thought it was doable to add > a certain instruction, that doesn't mean it makes sense > to use it! > > (Don't get me started on the 6812...) > Greetings, > Jaap > > -- Chip Directory > -- http://www.chipdir.biz/ > -- http://www.chipdir.info/ > -- http://www.chipdir.net/ > -- http://www.chipdir.nl/ > -- http://www.chipdir.org/ > -- And about 30 other mirror sites world-wide. > -- > -- To subscribe to a free 'chip issues, questions and answers' > -- mailing list, send a message to listguru@f... with > -- in the body 'subscribe chipdir-L'. About 500 experts are > -- willing to think with you about electronics problems etc. |
|
|
|
Hi all and Israel, My memory fails me for specifics about the HC11 (without going to the manual), but I am pretty sure there is a configuration register associated with the ADC that must be initialized before using it. Without BUFFALO running to do it for you, the ADC is probably disabled. Good luck, Scott Israel Brewster <> wrote: I have used bit instructions quite frequently in my programing and found them to be a valuable tool, making my code much simpler and more compact - frequently doing in one line what would otherwise take four or five lines at least. Be that as it may, the problem here has nothing to do with the bit instruction- as I mentioned in my original post, I have tried replacing it with a simple delay loop. The problem is that with BUFFALO disabled, the A/D conversion never takes place. Thus the conversion complete flag is never set, and thus the bit instruction loops infinitely waiting for it to be set. This is shown by the behavior experienced when the bit instruction is replaced with a delay loop, as described in my original post. Thanks anyway. --- In , Jaap van Ganswijk <ganswijk@x> wrote: > At 2004-11-29 02:11, Israel Brewster wrote: > >I am having some difficulty getting my code to execute with BUFFALO disabled. I am using an > >Adapt11C24DXEVB, and have my code loaded into the internal EEPROM starting at address > >B600. If I power up the board with BUFFALO enabled, and issue the go B600 command, > >everything works perfectly. However, if I then pull E0 high to disable buffalo, and reset the > >board, my program only runs until it tries to do an A/D conversion on port E7, where it hangs > >waiting for the conversion complete flag to be set. > > > >I am using the branch on bit clear command to loop back to itself until the flag is set, and am > >certain this command is correct both because I copied it from some code I have used before, > >and because, as I mentioned already, it DOES run properly when called from BUFFALO. If I > >replace the branch command with a delay loop that should be more than long enough for the > >conversions to complete (Y index register is decremented from $0700) program execution > >continues successfully past this point- except that the A/D conversion is never completed, > >which obviously causes the branches based on the result of the A/D conversion to branch > >improperly. Specifically, it always takes the branch for when the value is less than $41, while > >the actual value should be (and is when run from BUFFALO) close to or equal to $FF. > > > >I have already checked that I am setting the stack pointer ($CFFF) and enabling the interrupts > >(CLI), with no change. Can anyone tell me what I am missing here? Thanks. > > Beware that the bitwise instructions were added to the 6811 > instruction set by aliens from outer space and that they > tend to use unexpected read-modify-write-cycles to get > things done. That may upset registers in peripheral chips. > > Tip from a red blooded earthling (and compiler writer): > Don't use the bit instructions! > > Because some hardware idiot thought it was doable to add > a certain instruction, that doesn't mean it makes sense > to use it! > > (Don't get me started on the 6812...) > Greetings, > Jaap > > -- Chip Directory > -- http://www.chipdir.biz/ > -- http://www.chipdir.info/ > -- http://www.chipdir.net/ > -- http://www.chipdir.nl/ > -- http://www.chipdir.org/ > -- And about 30 other mirror sites world-wide. > -- > -- To subscribe to a free 'chip issues, questions and answers' > -- mailing list, send a message to listguru@f... with > -- in the body 'subscribe chipdir-L'. About 500 experts are > -- willing to think with you about electronics problems etc. Yahoo! Groups Sponsor Get unlimited calls to U.S./Canada --------------------------------- Yahoo! Groups Links To --------------------------------- |
|
|
|
Hi, Bit 7, ADPU,in the Option register, $1039, must be set. Keep having fun. Nick Reitter Personal home page http://www.reitter.net/nick/ Where we got o church http://www.shepherdwlsv.org/ Where I used to work before I retired http://web.alfredstate.edu/eet/ -----Original Message----- From: Jaap van Ganswijk [mailto:] Sent: Monday, November 29, 2004 5:05 AM To: Subject: Re: [m68HC11] Code Auto Execution problem At 2004-11-29 02:11, Israel Brewster wrote: >I am having some difficulty getting my code to execute with BUFFALO disabled. I am using an >Adapt11C24DXEVB, and have my code loaded into the internal EEPROM starting at address >B600. If I power up the board with BUFFALO enabled, and issue the go B600 command, >everything works perfectly. However, if I then pull E0 high to disable buffalo, and reset the >board, my program only runs until it tries to do an A/D conversion on port E7, where it hangs >waiting for the conversion complete flag to be set. > >I am using the branch on bit clear command to loop back to itself until the flag is set, and am >certain this command is correct both because I copied it from some code I have used before, >and because, as I mentioned already, it DOES run properly when called from BUFFALO. If I >replace the branch command with a delay loop that should be more than long enough for the >conversions to complete (Y index register is decremented from $0700) program execution >continues successfully past this point- except that the A/D conversion is never completed, >which obviously causes the branches based on the result of the A/D conversion to branch >improperly. Specifically, it always takes the branch for when the value is less than $41, while >the actual value should be (and is when run from BUFFALO) close to or equal to $FF. > >I have already checked that I am setting the stack pointer ($CFFF) and enabling the interrupts >(CLI), with no change. Can anyone tell me what I am missing here? Thanks. Beware that the bitwise instructions were added to the 6811 instruction set by aliens from outer space and that they tend to use unexpected read-modify-write-cycles to get things done. That may upset registers in peripheral chips. Tip from a red blooded earthling (and compiler writer): Don't use the bit instructions! Because some hardware idiot thought it was doable to add a certain instruction, that doesn't mean it makes sense to use it! (Don't get me started on the 6812...) Greetings, Jaap -- Chip Directory -- http://www.chipdir.biz/ -- http://www.chipdir.info/ -- http://www.chipdir.net/ -- http://www.chipdir.nl/ -- http://www.chipdir.org/ -- And about 30 other mirror sites world-wide. -- -- To subscribe to a free 'chip issues, questions and answers' -- mailing list, send a message to with -- in the body 'subscribe chipdir-L'. About 500 experts are -- willing to think with you about electronics problems etc. Yahoo! Groups Links |
|
|
|
----- Original Message ----- From: "Israel Brewster" <> To: < > I have used bit instructions quite frequently in my programing and found them to be a > valuable tool, making my code much simpler and more compact - frequently doing in one > line what would otherwise take four or five lines at least. Be that as it may, the problem > here has nothing to do with the bit instruction- as I mentioned in my original post, I have > tried replacing it with a simple delay loop. The problem is that with BUFFALO disabled, the > A/D conversion never takes place. Thus the conversion complete flag is never set, and > thus the bit instruction loops infinitely waiting for it to be set. This is shown by the > behavior experienced when the bit instruction is replaced with a delay loop, as described > in my original post. Thanks anyway. If it helps, here's one routine I've used: ;************************************************************** ; Purpose: Read an A/D channel (4 readings) and return average ; Input : A = A/D channel to read ; Output : A = Averaged reading ReadAD pshx pshb ldx #REGS anda #%111 ;isolate channel number sta [ADCTL,x ;convert channel in A (0-7) clra ;D will sum up 4 readings brclr [ADCTL,X,CCF.,* ;wait for conversion to finish ldb [ADR1,x ;D = 1st reading addb [ADR2,x adca #0 ;D = 1st+2nd readings addb [ADR3,x adca #0 ;D = 1st+2nd+3rd readings addb [ADR4,x adca #0 ;D = sum of all 4 readings lsrd:2 ;average (divide by 4) tba ;Result now in A pulb pulx rts ;************************************************************** Undefined labels: REGS is usually $1000 ADCTL is usually REGS+$30 ADR1..ADR4 are usually REGS+$31 .. REGS+$34 CCF. is $80 Using ASM11 v1.84d so syntax may require mods. |
|
Thank you, that certainly sounds promising. Would you be able to tell me where I could find more information about this register and the functions of its various bits? It is not mentioned in the HC11 book I have, aside from an acknowledgment of its existence in the I/O registers table. I'll give it a try, see what happens. Thanks! --- In , "Nick Reitter" <nick@r...> wrote: > Hi, Bit 7, ADPU,in the Option register, $1039, must be set. > Keep having fun. > Nick Reitter > Personal home page http://www.reitter.net/nick/ > Where we got o church http://www.shepherdwlsv.org/ > Where I used to work before I retired http://web.alfredstate.edu/eet/ > -----Original Message----- > From: Jaap van Ganswijk [mailto:ganswijk@x...] > Sent: Monday, November 29, 2004 5:05 AM > To: > Subject: Re: [m68HC11] Code Auto Execution problem > > At 2004-11-29 02:11, Israel Brewster wrote: > >I am having some difficulty getting my code to execute with BUFFALO > disabled. I am using an > >Adapt11C24DXEVB, and have my code loaded into the internal EEPROM starting > at address > >B600. If I power up the board with BUFFALO enabled, and issue the go B600 > command, > >everything works perfectly. However, if I then pull E0 high to disable > buffalo, and reset the > >board, my program only runs until it tries to do an A/D conversion on port > E7, where it hangs > >waiting for the conversion complete flag to be set. > > > >I am using the branch on bit clear command to loop back to itself until the > flag is set, and am > >certain this command is correct both because I copied it from some code I > have used before, > >and because, as I mentioned already, it DOES run properly when called from > BUFFALO. If I > >replace the branch command with a delay loop that should be more than long > enough for the > >conversions to complete (Y index register is decremented from $0700) > program execution > >continues successfully past this point- except that the A/D conversion is > never completed, > >which obviously causes the branches based on the result of the A/D > conversion to branch > >improperly. Specifically, it always takes the branch for when the value is > less than $41, while > >the actual value should be (and is when run from BUFFALO) close to or equal > to $FF. > > > >I have already checked that I am setting the stack pointer ($CFFF) and > enabling the interrupts > >(CLI), with no change. Can anyone tell me what I am missing here? Thanks. > > Beware that the bitwise instructions were added to the 6811 > instruction set by aliens from outer space and that they > tend to use unexpected read-modify-write-cycles to get > things done. That may upset registers in peripheral chips. > > Tip from a red blooded earthling (and compiler writer): > Don't use the bit instructions! > > Because some hardware idiot thought it was doable to add > a certain instruction, that doesn't mean it makes sense > to use it! > > (Don't get me started on the 6812...) > Greetings, > Jaap > > -- Chip Directory > -- http://www.chipdir.biz/ > -- http://www.chipdir.info/ > -- http://www.chipdir.net/ > -- http://www.chipdir.nl/ > -- http://www.chipdir.org/ > -- And about 30 other mirror sites world-wide. > -- > -- To subscribe to a free 'chip issues, questions and answers' > -- mailing list, send a message to listguru@f... with > -- in the body 'subscribe chipdir-L'. About 500 experts are > -- willing to think with you about electronics problems etc. > Yahoo! Groups Links |
|
|
|
Yep, that did the trick. Thanks all for the suggestions! --- In , "Israel Brewster" <fsijb@u...> wrote: > > Thank you, that certainly sounds promising. Would you be able to tell me where I could > find more information about this register and the functions of its various bits? It is not > mentioned in the HC11 book I have, aside from an acknowledgment of its existence in the > I/O registers table. I'll give it a try, see what happens. Thanks! > > --- In , "Nick Reitter" <nick@r...> wrote: > > Hi, Bit 7, ADPU,in the Option register, $1039, must be set. > > Keep having fun. > > Nick Reitter > > Personal home page http://www.reitter.net/nick/ > > Where we got o church http://www.shepherdwlsv.org/ > > Where I used to work before I retired http://web.alfredstate.edu/eet/ > > > > > > -----Original Message----- > > From: Jaap van Ganswijk [mailto:ganswijk@x] > > Sent: Monday, November 29, 2004 5:05 AM > > To: > > Subject: Re: [m68HC11] Code Auto Execution problem > > > > > > > > At 2004-11-29 02:11, Israel Brewster wrote: > > >I am having some difficulty getting my code to execute with BUFFALO > > disabled. I am using an > > >Adapt11C24DXEVB, and have my code loaded into the internal EEPROM starting > > at address > > >B600. If I power up the board with BUFFALO enabled, and issue the go B600 > > command, > > >everything works perfectly. However, if I then pull E0 high to disable > > buffalo, and reset the > > >board, my program only runs until it tries to do an A/D conversion on port > > E7, where it hangs > > >waiting for the conversion complete flag to be set. > > > > > >I am using the branch on bit clear command to loop back to itself until the > > flag is set, and am > > >certain this command is correct both because I copied it from some code I > > have used before, > > >and because, as I mentioned already, it DOES run properly when called from > > BUFFALO. If I > > >replace the branch command with a delay loop that should be more than long > > enough for the > > >conversions to complete (Y index register is decremented from $0700) > > program execution > > >continues successfully past this point- except that the A/D conversion is > > never completed, > > >which obviously causes the branches based on the result of the A/D > > conversion to branch > > >improperly. Specifically, it always takes the branch for when the value is > > less than $41, while > > >the actual value should be (and is when run from BUFFALO) close to or equal > > to $FF. > > > > > >I have already checked that I am setting the stack pointer ($CFFF) and > > enabling the interrupts > > >(CLI), with no change. Can anyone tell me what I am missing here? Thanks. > > > > Beware that the bitwise instructions were added to the 6811 > > instruction set by aliens from outer space and that they > > tend to use unexpected read-modify-write-cycles to get > > things done. That may upset registers in peripheral chips. > > > > Tip from a red blooded earthling (and compiler writer): > > Don't use the bit instructions! > > > > Because some hardware idiot thought it was doable to add > > a certain instruction, that doesn't mean it makes sense > > to use it! > > > > (Don't get me started on the 6812...) > > > > > > Greetings, > > Jaap > > > > -- Chip Directory > > -- http://www.chipdir.biz/ > > -- http://www.chipdir.info/ > > -- http://www.chipdir.net/ > > -- http://www.chipdir.nl/ > > -- http://www.chipdir.org/ > > -- And about 30 other mirror sites world-wide. > > -- > > -- To subscribe to a free 'chip issues, questions and answers' > > -- mailing list, send a message to listguru@f... with > > -- in the body 'subscribe chipdir-L'. About 500 experts are > > -- willing to think with you about electronics problems etc. > > > > > > > > > > > > Yahoo! Groups Links |
|
--- In , Scott Grodevant <scott14468@y...> wrote: > Hi all and Israel, > > My memory fails me for specifics about the HC11 (without going to > the manual), but I am pretty sure there is a configuration register > associated with the ADC that must be initialized before using it. > Without BUFFALO running to do it for you, the ADC is probably > disabled. What Scott says here comes close to the advice I will offer. When you transition from a debug environment (e.g. BUFFALO/PCBUG/JBug/etc.) to a 'standalone' runtime environment, you must take care to ensure that your program includes ALL necessary initialization code. This means things like: Setting the stack pointer and status register properly, initializing all your RAM variables to known values, setting values in time-protected registers such as HPRIO, and initializing ALL subsystems you are using. You can get away without doing much of the above because a typical monitor program will place the MCU in a known, safe-operation state as part of its own initialization. This is not true when you start up out of reset directly into your own program. You are responsible for initializing any subsystem/peripheral you choose to use, and are also responsible for initializing the CPU registers and memory appropriately. |
|
|
|
yeah, good advice- and absolutely true. The annoying thing about this situation is that, as far as I can tell, the need to initialize the OPTION register is completely undocumented, at least in the materials I have available. Its existence is not even mentioned in the book I have on the subject. So while I am aware of the need to initialize everything, I don't know what all needs to be initialized. This, of course, leads to very annoying problems such as the one I just experienced. If anyone wants to suggest some good reference sources for programing with the HC11/HC12 (thinking of moving up) that mention such things, I would appreciate it. Thanks again everyone. --- In , "Mark Schultz" <n9xmj@y...> wrote: > > --- In , Scott Grodevant <scott14468@y...> > wrote: > > Hi all and Israel, > > > > My memory fails me for specifics about the HC11 (without going to > > the manual), but I am pretty sure there is a configuration register > > associated with the ADC that must be initialized before using it. > > Without BUFFALO running to do it for you, the ADC is probably > > disabled. > > What Scott says here comes close to the advice I will offer. > > When you transition from a debug environment (e.g. > BUFFALO/PCBUG/JBug/etc.) to a 'standalone' runtime environment, you > must take care to ensure that your program includes ALL necessary > initialization code. This means things like: Setting the stack > pointer and status register properly, initializing all your RAM > variables to known values, setting values in time-protected registers > such as HPRIO, and initializing ALL subsystems you are using. > > You can get away without doing much of the above because a typical > monitor program will place the MCU in a known, safe-operation state > as part of its own initialization. This is not true when you start > up out of reset directly into your own program. You are responsible > for initializing any subsystem/peripheral you choose to use, and are > also responsible for initializing the CPU registers and memory > appropriately. |
|
|
|
For the 68HC11 you need the Motorola reference manual literature# M68HC11RM/AD and the Motorola technical data for the particular family of HC11. They are available as pdf files on the freescale web site. I suspect there are equivalent manuals for the HC12 series also on the web site. Paul > -----Original Message----- > From: Israel Brewster [mailto:] > Sent: Tuesday, November 30, 2004 12:16 PM > > yeah, good advice- and absolutely true. The annoying thing about > this situation is that, as > far as I can tell, the need to initialize the OPTION register is > completely undocumented, at > least in the materials I have available. Its existence is not > even mentioned in the book I > have on the subject. So while I am aware of the need to > initialize everything, I don't know > what all needs to be initialized. This, of course, leads to very > annoying problems such as > the one I just experienced. If anyone wants to suggest some good > reference sources for > programing with the HC11/HC12 (thinking of moving up) that > mention such things, I > would appreciate it. Thanks again everyone. |
|
Hi all and Israel, Well, the need to initialize the OPTION register isn't exactly undocumented. The manual states it's default settings. Aparently they differ from your application's requirements. In the world of electronic design, all manufacturers publish detailed specifications for their devices, it is up to the designer to obtain and read them. Yeah, we all make mistakes. The manuals will not tell you what registers to initialize. In general, you must initialize any registers dealing with hardware you intend to use or any that are in a state that differs from your application's requirements. Further, if you don't initialize registers that are in a "correct" state, there is no guarantee (although it is rather unlikely) future mask sets won't be incompatible with your code. Good luck, Scott Israel Brewster <> wrote: yeah, good advice- and absolutely true. The annoying thing about this situation is that, as far as I can tell, the need to initialize the OPTION register is completely undocumented, at least in the materials I have available. Its existence is not even mentioned in the book I have on the subject. So while I am aware of the need to initialize everything, I don't know what all needs to be initialized. This, of course, leads to very annoying problems such as the one I just experienced. If anyone wants to suggest some good reference sources for programing with the HC11/HC12 (thinking of moving up) that mention such things, I would appreciate it. Thanks again everyone. --- In , "Mark Schultz" <n9xmj@y...> wrote: > > --- In , Scott Grodevant <scott14468@y...> > wrote: > > Hi all and Israel, > > > > My memory fails me for specifics about the HC11 (without going to > > the manual), but I am pretty sure there is a configuration register > > associated with the ADC that must be initialized before using it. > > Without BUFFALO running to do it for you, the ADC is probably > > disabled. > > What Scott says here comes close to the advice I will offer. > > When you transition from a debug environment (e.g. > BUFFALO/PCBUG/JBug/etc.) to a 'standalone' runtime environment, you > must take care to ensure that your program includes ALL necessary > initialization code. This means things like: Setting the stack > pointer and status register properly, initializing all your RAM > variables to known values, setting values in time-protected registers > such as HPRIO, and initializing ALL subsystems you are using. > > You can get away without doing much of the above because a typical > monitor program will place the MCU in a known, safe-operation state > as part of its own initialization. This is not true when you start > up out of reset directly into your own program. You are responsible > for initializing any subsystem/peripheral you choose to use, and are > also responsible for initializing the CPU registers and memory > appropriately. Yahoo! Groups SponsorADVERTISEMENT --------------------------------- Yahoo! Groups Links To --------------------------------- |
|
|
|
I would have to agree. In fact, whenever I write a program I start with a
"shell" that contains a reference to every register, and a vector table to all
of the interupts. If I don't need it, then I delete it. I have a terrible memory, if you
haven't already figured out by reading my other postings, so doing such things helps to
relieve my frustrations. Just a suggestion. If you want to see a bit of what I am talking
about, then you can look at the Bit-Banging program that I uploaded to this group's file
section. You can see the Interupt vector table at the bottom of the file. You will also
notice many registers that are EQU'ed, in the begining of the file, are not being used. I
really did not need to conserve space for this program so I left them there. Take care. LF Israel Brewster <> wrote: yeah, good advice- and absolutely true. The annoying thing about this situation is that, as far as I can tell, the need to initialize the OPTION register is completely undocumented, at least in the materials I have available. Its existence is not even mentioned in the book I have on the subject. So while I am aware of the need to initialize everything, I don't know what all needs to be initialized. This, of course, leads to very annoying problems such as the one I just experienced. If anyone wants to suggest some good reference sources for programing with the HC11/HC12 (thinking of moving up) that mention such things, I would appreciate it. Thanks again everyone. --- In , "Mark Schultz" <n9xmj@y...> wrote: > > --- In , Scott Grodevant <scott14468@y...> > wrote: > > Hi all and Israel, > > > > My memory fails me for specifics about the HC11 (without going to > > the manual), but I am pretty sure there is a configuration register > > associated with the ADC that must be initialized before using it. > > Without BUFFALO running to do it for you, the ADC is probably > > disabled. > > What Scott says here comes close to the advice I will offer. > > When you transition from a debug environment (e.g. > BUFFALO/PCBUG/JBug/etc.) to a 'standalone' runtime environment, you > must take care to ensure that your program includes ALL necessary > initialization code. This means things like: Setting the stack > pointer and status register properly, initializing all your RAM > variables to known values, setting values in time-protected registers > such as HPRIO, and initializing ALL subsystems you are using. > > You can get away without doing much of the above because a typical > monitor program will place the MCU in a known, safe-operation state > as part of its own initialization. This is not true when you start > up out of reset directly into your own program. You are responsible > for initializing any subsystem/peripheral you choose to use, and are > also responsible for initializing the CPU registers and memory > appropriately. Yahoo! Groups SponsorADVERTISEMENT --------------------------------- Yahoo! Groups Links To --------------------------------- |
|
Well, I'm sure the OPTION register is documented somewhere, just not in any of the documentation I have looked at. I guess I just have all the wrong documentation :-) If I had had some sort of a list giving all the registers, what their purpose was, and what they were initialized to, I could have figured this out myself in about five minutes flat (or less, depending on how long it took me to scan the list). Unfortunately, I have no such list. --- In , "Nick Reitter" <nick@r...> wrote: > Here are two texts that good: > "Microcontroller Technology - The 68HC11"; Peter Saspov, Prentice Hall > "Data Acquisition and Process Control with the M68HC11 Microcontroller"; > Driscoll etal; Prentice Hall > > Nick Yeah, that second one is what I have. Good book, but I am finding it to be more and more lacking as I learn more about the microcontroller and programing. Like the fact that it doesn't mention the option register, at least that I have found. I'll have to check out that first one sometime. Thanks again for the assistance and info --- In , Scott Grodevant <scott14468@y...> wrote: > Hi all and Israel, > > Well, the need to initialize the OPTION register isn't exactly undocumented. The manual states it's default settings. Aparently they differ from your application's requirements. In the world of electronic design, all manufacturers publish detailed specifications for their devices, it is up to the designer to obtain and read them. Yeah, we all make mistakes. > > The manuals will not tell you what registers to initialize. In general, you must initialize any registers dealing with hardware you intend to use or any that are in a state that differs from your application's requirements. Further, if you don't initialize registers that are in a "correct" state, there is no guarantee (although it is rather unlikely) future mask sets won't be incompatible with your code. > Good luck, > Scott |
|
|
|
I think you need the MC68HC11 Reference GUIDE and not the reference MANUAL. The
reference GUIDE has a complete listing of all of the registers and interupts. I will post
it in the "Files" section of this group. LF Israel Brewster <> wrote: Well, I'm sure the OPTION register is documented somewhere, just not in any of the documentation I have looked at. I guess I just have all the wrong documentation :-) If I had had some sort of a list giving all the registers, what their purpose was, and what they were initialized to, I could have figured this out myself in about five minutes flat (or less, depending on how long it took me to scan the list). Unfortunately, I have no such list. --- In , "Nick Reitter" <nick@r...> wrote: > Here are two texts that good: > "Microcontroller Technology - The 68HC11"; Peter Saspov, Prentice Hall > "Data Acquisition and Process Control with the M68HC11 Microcontroller"; > Driscoll etal; Prentice Hall > > Nick Yeah, that second one is what I have. Good book, but I am finding it to be more and more lacking as I learn more about the microcontroller and programing. Like the fact that it doesn't mention the option register, at least that I have found. I'll have to check out that first one sometime. Thanks again for the assistance and info --- In , Scott Grodevant <scott14468@y...> wrote: > Hi all and Israel, > > Well, the need to initialize the OPTION register isn't exactly undocumented. The manual states it's default settings. Aparently they differ from your application's requirements. In the world of electronic design, all manufacturers publish detailed specifications for their devices, it is up to the designer to obtain and read them. Yeah, we all make mistakes. > > The manuals will not tell you what registers to initialize. In general, you must initialize any registers dealing with hardware you intend to use or any that are in a state that differs from your application's requirements. Further, if you don't initialize registers that are in a "correct" state, there is no guarantee (although it is rather unlikely) future mask sets won't be incompatible with your code. > Good luck, > Scott Yahoo! Groups SponsorADVERTISEMENT --------------------------------- Yahoo! Groups Links To --------------------------------- |
|
|
|
Thanks! That looks very useful. --- In , bart homerson <odddooo1@y...> wrote: > I think you need the MC68HC11 Reference GUIDE and not the reference MANUAL. The reference GUIDE has a complete listing of all of the registers and interupts. I will post it in the "Files" section of this group. > > LF > > Israel Brewster <fsijb@u...> wrote: > > Well, I'm sure the OPTION register is documented somewhere, just not in any of the > documentation I have looked at. I guess I just have all the wrong documentation :-) If I had > had some sort of a list giving all the registers, what their purpose was, and what they were > initialized to, I could have figured this out myself in about five minutes flat (or less, > depending on how long it took me to scan the list). Unfortunately, I have no such list. > > --- In , "Nick Reitter" <nick@r...> wrote: > > Here are two texts that good: > > "Microcontroller Technology - The 68HC11"; Peter Saspov, Prentice Hall > > "Data Acquisition and Process Control with the M68HC11 Microcontroller"; > > Driscoll etal; Prentice Hall > > > > Nick > > Yeah, that second one is what I have. Good book, but I am finding it to be more and more > lacking as I learn more about the microcontroller and programing. Like the fact that it > doesn't mention the option register, at least that I have found. I'll have to check out that > first one sometime. Thanks again for the assistance and info > > --- In , Scott Grodevant <scott14468@y...> wrote: > > Hi all and Israel, > > > > Well, the need to initialize the OPTION register isn't exactly undocumented. The manual > states it's default settings. Aparently they differ from your application's requirements. > In the world of electronic design, all manufacturers publish detailed specifications for their > devices, it is up to the designer to obtain and read them. Yeah, we all make mistakes. > > > > The manuals will not tell you what registers to initialize. In general, you must initialize > any registers dealing with hardware you intend to use or any that are in a state that differs > from your application's requirements. Further, if you don't initialize registers that are in a > "correct" state, there is no guarantee (although it is rather unlikely) future mask sets won't > be incompatible with your code. > > > > > > Good luck, > > Scott > > > Yahoo! Groups SponsorADVERTISEMENT > --------------------------------- > Yahoo! Groups Links > > To > > --------------------------------- |
|
|
|
Israel, You are quite welcome! I had the same problem when I was first starting out with these chips. Now, I always keep a copy on every computer that I might possibly write a program on. I used to have a hard copy of this guide that comes as a little book that fits in your pocket, but I lost it. I got my copy included with my starter kit from Technological arts, but I think you can order a hard copy from Freescale semiconductor. LF Israel Brewster <> wrote: Thanks! That looks very useful. --- In , bart homerson <odddooo1@y...> wrote: > I think you need the MC68HC11 Reference GUIDE and not the reference MANUAL. The reference GUIDE has a complete listing of all of the registers and interupts. I will post it in the "Files" section of this group. > > LF > > Israel Brewster <fsijb@u...> wrote: > > Well, I'm sure the OPTION register is documented somewhere, just not in any of the > documentation I have looked at. I guess I just have all the wrong documentation :-) If I had > had some sort of a list giving all the registers, what their purpose was, and what they were > initialized to, I could have figured this out myself in about five minutes flat (or less, > depending on how long it took me to scan the list). Unfortunately, I have no such list. > > --- In , "Nick Reitter" <nick@r...> wrote: > > Here are two texts that good: > > "Microcontroller Technology - The 68HC11"; Peter Saspov, Prentice Hall > > "Data Acquisition and Process Control with the M68HC11 Microcontroller"; > > Driscoll etal; Prentice Hall > > > > Nick > > Yeah, that second one is what I have. Good book, but I am finding it to be more and more > lacking as I learn more about the microcontroller and programing. Like the fact that it > doesn't mention the option register, at least that I have found. I'll have to check out that > first one sometime. Thanks again for the assistance and info > > --- In , Scott Grodevant <scott14468@y...> wrote: > > Hi all and Israel, > > > > Well, the need to initialize the OPTION register isn't exactly undocumented. The manual > states it's default settings. Aparently they differ from your application's requirements. > In the world of electronic design, all manufacturers publish detailed specifications for their > devices, it is up to the designer to obtain and read them. Yeah, we all make mistakes. > > > > The manuals will not tell you what registers to initialize. In general, you must initialize > any registers dealing with hardware you intend to use or any that are in a state that differs > from your application's requirements. Further, if you don't initialize registers that are in a > "correct" state, there is no guarantee (although it is rather unlikely) future mask sets won't > be incompatible with your code. > > > > > > Good luck, > > Scott > > > Yahoo! Groups SponsorADVERTISEMENT > --------------------------------- > Yahoo! Groups Links > > To > > --------------------------------- > ">http://mail.yahoo.com [Non-text portions of this message have been removed] |