4. a) For the BASIC Stamp 2 (BS2) how many bits of Random Access Memory are avai
ID: 2249685 • Letter: 4
Question
4. a) For the BASIC Stamp 2 (BS2) how many bits of Random Access Memory are available for the general-purpose variables? 4b) (Motivate your answer) What will be displayed in the debug terminal as a result of the following program: result var VAR Nib result var = 3 + 3 * 5-2 DEBUG? result_var 4. Which one of the following PBASIC commands will produce a 0.5 kHz tone for 20 s when Pin 2 is connected to a piezospeaker? Motivate your answer (A) FREQOUT 2, 20000, 5000 (B) FREQOUT 2, 5000, 20000 (C) FREQOUT 2, 20000, 500 (D FREQOUT 1, 5, 2000Explanation / Answer
Answer:- In BS2, 26 Bytes i.e 26*8 = 208 bits are available for general-purpose variable. Total 32 Byte is for variable. So 6 byte is for io variables.
variable result_var is decleared as a nibble variable i.e of 4-bits. So it can keep value from 0 to 15. The result here is 16 i.e 10000 in binary. So last four bit will be kept in varibe, hence output is zero.
Option (C) is correct. The syntax for FREQOUT is-
FREQOUT pin, duration, frequency. Where 0<pin<15, 0<duration<65535 in ms, and 0<frequency<32767 in Hz.
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.